summaryrefslogtreecommitdiff
path: root/noncore/multimedia
Unidiff
Diffstat (limited to 'noncore/multimedia') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp8
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/om3u.cpp14
-rw-r--r--noncore/multimedia/opieplayer2/playlistselection.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp38
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/skin.cpp24
-rw-r--r--noncore/multimedia/opieplayer2/threadutil.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp8
-rw-r--r--noncore/multimedia/opierec/device.cpp46
-rw-r--r--noncore/multimedia/opierec/helpwindow.cpp11
-rw-r--r--noncore/multimedia/opierec/opierec.pro6
-rw-r--r--noncore/multimedia/opierec/qtrec.cpp129
-rw-r--r--noncore/multimedia/opierec/wavFile.cpp67
-rw-r--r--noncore/multimedia/opierec/waveform.cpp12
-rw-r--r--noncore/multimedia/powerchord/config.in6
-rw-r--r--noncore/multimedia/powerchord/powerchord.pro3
-rw-r--r--noncore/multimedia/powerchord/powerchordbase.cpp12
-rw-r--r--noncore/multimedia/showimg/ImageFileSelector.cpp20
-rw-r--r--noncore/multimedia/showimg/showimg.cpp20
-rw-r--r--noncore/multimedia/showimg/showimg.pro2
-rw-r--r--noncore/multimedia/tonleiter/config.in2
-rw-r--r--noncore/multimedia/tonleiter/editinst.cpp11
-rw-r--r--noncore/multimedia/tonleiter/fretboard.cpp13
-rw-r--r--noncore/multimedia/tonleiter/tonleiter.pro6
-rw-r--r--noncore/multimedia/tonleiter/tonleiterdata.cpp11
-rw-r--r--noncore/multimedia/tonleiter/tonleiterdatahelper.cpp6
28 files changed, 271 insertions, 246 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 28a42eb..36def67 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -124,25 +124,25 @@ void AudioWidget::sliderPressed() {
124} 124}
125 125
126 126
127void AudioWidget::sliderReleased() { 127void AudioWidget::sliderReleased() {
128 audioSliderBeingMoved = FALSE; 128 audioSliderBeingMoved = FALSE;
129 if ( slider.width() == 0 ) 129 if ( slider.width() == 0 )
130 return; 130 return;
131 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); 131 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width());
132 mediaPlayerState.setPosition( val ); 132 mediaPlayerState.setPosition( val );
133} 133}
134 134
135void AudioWidget::setPosition( long i ) { 135void AudioWidget::setPosition( long i ) {
136 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 136 // odebug << "<<<<<<<<<<<<<<<<<<<<<<<<set position " << i << "" << oendl;
137 updateSlider( i, mediaPlayerState.length() ); 137 updateSlider( i, mediaPlayerState.length() );
138} 138}
139 139
140 140
141void AudioWidget::setLength( long max ) { 141void AudioWidget::setLength( long max ) {
142 updateSlider( mediaPlayerState.position(), max ); 142 updateSlider( mediaPlayerState.position(), max );
143} 143}
144 144
145 145
146void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { 146void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) {
147 if ( mediaType == MediaPlayerState::Audio ) { 147 if ( mediaType == MediaPlayerState::Audio ) {
148 // startTimer( 150 ); 148 // startTimer( 150 );
@@ -178,37 +178,37 @@ void AudioWidget::loadSkin()
178 time.setFocusPolicy( QWidget::NoFocus ); 178 time.setFocusPolicy( QWidget::NoFocus );
179 time.setAlignment( Qt::AlignCenter ); 179 time.setAlignment( Qt::AlignCenter );
180 180
181// time.setFrame(FALSE); 181// time.setFrame(FALSE);
182// changeTextColor( &time ); 182// changeTextColor( &time );
183 183
184 resizeEvent( 0 ); 184 resizeEvent( 0 );
185} 185}
186 186
187void AudioWidget::setSeekable( bool isSeekable ) { 187void AudioWidget::setSeekable( bool isSeekable ) {
188 188
189 if ( !isSeekable ) { 189 if ( !isSeekable ) {
190 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); 190 odebug << "<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>" << oendl;
191 if( !slider.isHidden()) { 191 if( !slider.isHidden()) {
192 slider.hide(); 192 slider.hide();
193 } 193 }
194 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 194 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
195 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 195 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
196 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 196 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
197 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 197 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
198 } else { 198 } else {
199 // this stops the slider from being moved, thus 199 // this stops the slider from being moved, thus
200 // does not stop stream when it reaches the end 200 // does not stop stream when it reaches the end
201 slider.show(); 201 slider.show();
202 qDebug( " CONNECT SET POSTION " ); 202 odebug << " CONNECT SET POSTION " << oendl;
203 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 203 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
204 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 204 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
205 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 205 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
206 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 206 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
207 } 207 }
208} 208}
209 209
210 210
211static QString timeAsString( long length ) { 211static QString timeAsString( long length ) {
212 int minutes = length / 60; 212 int minutes = length / 60;
213 int seconds = length % 60; 213 int seconds = length % 60;
214 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); 214 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 );
@@ -262,25 +262,25 @@ void AudioWidget::timerEvent( QTimerEvent * ) {
262 } else if ( skipDirection == -1 ) { 262 } else if ( skipDirection == -1 ) {
263 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); 263 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
264 } 264 }
265} 265}
266 266
267void AudioWidget::keyReleaseEvent( QKeyEvent *e) { 267void AudioWidget::keyReleaseEvent( QKeyEvent *e) {
268 switch ( e->key() ) { 268 switch ( e->key() ) {
269 ////////////////////////////// Zaurus keys 269 ////////////////////////////// Zaurus keys
270 case Key_Home: 270 case Key_Home:
271 break; 271 break;
272 case Key_F9: //activity 272 case Key_F9: //activity
273 hide(); 273 hide();
274 // qDebug("Audio F9"); 274 // odebug << "Audio F9" << oendl;
275 e->accept(); 275 e->accept();
276 break; 276 break;
277 case Key_F10: //contacts 277 case Key_F10: //contacts
278 break; 278 break;
279 case Key_F11: //menu 279 case Key_F11: //menu
280 mediaPlayerState.toggleBlank(); 280 mediaPlayerState.toggleBlank();
281 e->accept(); 281 e->accept();
282 break; 282 break;
283 case Key_F12: //home 283 case Key_F12: //home
284 break; 284 break;
285 case Key_F13: //mail 285 case Key_F13: //mail
286 mediaPlayerState.toggleBlank(); 286 mediaPlayerState.toggleBlank();
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index a42b8e5..5c24dbe 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -97,28 +97,28 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
97 } 97 }
98 98
99 if ( initMode == InitializeImmediately ) { 99 if ( initMode == InitializeImmediately ) {
100 initialize(); 100 initialize();
101 m_initialized = true; 101 m_initialized = true;
102 } 102 }
103 else 103 else
104 start(); 104 start();
105} 105}
106 106
107void Lib::run() 107void Lib::run()
108{ 108{
109 qDebug( "Lib::run() started" ); 109 odebug << "Lib::run() started" << oendl;
110 initialize(); 110 initialize();
111 m_initialized = true; 111 m_initialized = true;
112 qDebug( "Lib::run() finished" ); 112 odebug << "Lib::run() finished" << oendl;
113} 113}
114 114
115void Lib::initialize() 115void Lib::initialize()
116{ 116{
117 m_duringInitialization = true; 117 m_duringInitialization = true;
118 m_xine = xine_new( ); 118 m_xine = xine_new( );
119 119
120 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 120 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
121 xine_config_load( m_xine, QFile::encodeName( configPath ) ); 121 xine_config_load( m_xine, QFile::encodeName( configPath ) );
122 122
123 xine_init( m_xine ); 123 xine_init( m_xine );
124 124
@@ -206,25 +206,25 @@ int Lib::play( const QString& fileName, int startPos, int start_time ) {
206 //m_queue = xine_event_new_queue (m_stream); 206 //m_queue = xine_event_new_queue (m_stream);
207 //xine_event_create_listener_thread (m_queue, xine_event_handler, this); 207 //xine_event_create_listener_thread (m_queue, xine_event_handler, this);
208 208
209 if ( !xine_open( m_stream, str.utf8().data() ) ) { 209 if ( !xine_open( m_stream, str.utf8().data() ) ) {
210 return 0; 210 return 0;
211 } 211 }
212 return xine_play( m_stream, startPos, start_time); 212 return xine_play( m_stream, startPos, start_time);
213} 213}
214 214
215void Lib::stop() { 215void Lib::stop() {
216 assert( m_initialized ); 216 assert( m_initialized );
217 217
218 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); 218 odebug << "<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>" << oendl;
219 xine_stop( m_stream ); 219 xine_stop( m_stream );
220} 220}
221 221
222void Lib::pause( bool toggle ) { 222void Lib::pause( bool toggle ) {
223 assert( m_initialized ); 223 assert( m_initialized );
224 224
225 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); 225 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL );
226} 226}
227 227
228int Lib::speed() const { 228int Lib::speed() const {
229 assert( m_initialized ); 229 assert( m_initialized );
230 230
@@ -318,27 +318,27 @@ QString Lib::metaInfo( int number) const {
318 318
319int Lib::error() const { 319int Lib::error() const {
320 assert( m_initialized ); 320 assert( m_initialized );
321 321
322 return xine_get_error( m_stream ); 322 return xine_get_error( m_stream );
323}; 323};
324 324
325void Lib::ensureInitialized() 325void Lib::ensureInitialized()
326{ 326{
327 if ( m_initialized ) 327 if ( m_initialized )
328 return; 328 return;
329 329
330 qDebug( "waiting for initialization thread to finish" ); 330 odebug << "waiting for initialization thread to finish" << oendl;
331 wait(); 331 wait();
332 qDebug( "initialization thread finished!" ); 332 odebug << "initialization thread finished!" << oendl;
333} 333}
334 334
335void Lib::setWidget( XineVideoWidget *widget ) 335void Lib::setWidget( XineVideoWidget *widget )
336{ 336{
337 m_wid = widget; 337 m_wid = widget;
338 resize ( m_wid-> size ( ) ); 338 resize ( m_wid-> size ( ) );
339 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); 339 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
340 m_wid->repaint(); 340 m_wid->repaint();
341} 341}
342 342
343void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) 343void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType )
344{ 344{
@@ -413,20 +413,20 @@ void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) {
413 ( (Lib*)user_data)->handleXineEvent( t ); 413 ( (Lib*)user_data)->handleXineEvent( t );
414} 414}
415 415
416void Lib::xine_display_frame( void* user_data, uint8_t *frame, 416void Lib::xine_display_frame( void* user_data, uint8_t *frame,
417 int width, int height, int bytes ) { 417 int width, int height, int bytes ) {
418 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); 418 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes );
419} 419}
420 420
421void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { 421void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
422 assert( m_initialized ); 422 assert( m_initialized );
423 423
424 if ( !m_video ) { 424 if ( !m_video ) {
425 qWarning("not showing video now"); 425 owarn << "not showing video now" << oendl;
426 return; 426 return;
427 } 427 }
428 428
429 assert( m_wid ); 429 assert( m_wid );
430 430
431 m_wid-> setVideoFrame ( frame, width, height, bytes ); 431 m_wid-> setVideoFrame ( frame, width, height, bytes );
432} 432}
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index a236775..7e38fc7 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -143,25 +143,25 @@ void MediaPlayer::next() {
143 143
144 if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist 144 if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist
145 if ( playList.next() ) { 145 if ( playList.next() ) {
146 play(); 146 play();
147 } else if ( mediaPlayerState.isLooping() ) { 147 } else if ( mediaPlayerState.isLooping() ) {
148 if ( playList.first() ) { 148 if ( playList.first() ) {
149 play(); 149 play();
150 } 150 }
151 } else { 151 } else {
152 mediaPlayerState.setList(); 152 mediaPlayerState.setList();
153 } 153 }
154 } else { //if playing from file list, let's just stop 154 } else { //if playing from file list, let's just stop
155 qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); 155 odebug << "<<<<<<<<<<<<<<<<<stop for filelists" << oendl;
156 mediaPlayerState.setPlaying(false); 156 mediaPlayerState.setPlaying(false);
157 mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); 157 mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection );
158 if(l) mediaPlayerState.setLooping(l); 158 if(l) mediaPlayerState.setLooping(l);
159 if(r) mediaPlayerState.setShuffled(r); 159 if(r) mediaPlayerState.setShuffled(r);
160 } 160 }
161 qApp->processEvents(); 161 qApp->processEvents();
162} 162}
163 163
164 164
165void MediaPlayer::startDecreasingVolume() { 165void MediaPlayer::startDecreasingVolume() {
166 volumeDirection = -1; 166 volumeDirection = -1;
167 startTimer( 100 ); 167 startTimer( 100 );
@@ -276,69 +276,69 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
276 } 276 }
277 } 277 }
278} 278}
279 279
280 280
281void MediaPlayer::blank( bool b ) { 281void MediaPlayer::blank( bool b ) {
282 fd=open("/dev/fb0",O_RDWR); 282 fd=open("/dev/fb0",O_RDWR);
283#ifdef QT_QWS_SL5XXX 283#ifdef QT_QWS_SL5XXX
284 fl= open( "/dev/fl", O_RDWR ); 284 fl= open( "/dev/fl", O_RDWR );
285#endif 285#endif
286 if (fd != -1) { 286 if (fd != -1) {
287 if ( b ) { 287 if ( b ) {
288 qDebug("do blanking"); 288 odebug << "do blanking" << oendl;
289#ifdef QT_QWS_SL5XXX 289#ifdef QT_QWS_SL5XXX
290 ioctl( fd, FBIOBLANK, 1 ); 290 ioctl( fd, FBIOBLANK, 1 );
291 if(fl !=-1) { 291 if(fl !=-1) {
292 ioctl( fl, 2 ); 292 ioctl( fl, 2 );
293 ::close(fl); 293 ::close(fl);
294 } 294 }
295#else 295#else
296 ioctl( fd, FBIOBLANK, 3 ); 296 ioctl( fd, FBIOBLANK, 3 );
297#endif 297#endif
298 isBlanked = TRUE; 298 isBlanked = TRUE;
299 } else { 299 } else {
300 qDebug("do unblanking"); 300 odebug << "do unblanking" << oendl;
301 ioctl( fd, FBIOBLANK, 0); 301 ioctl( fd, FBIOBLANK, 0);
302#ifdef QT_QWS_SL5XXX 302#ifdef QT_QWS_SL5XXX
303 if(fl != -1) { 303 if(fl != -1) {
304 ioctl( fl, 1); 304 ioctl( fl, 1);
305 ::close(fl); 305 ::close(fl);
306 } 306 }
307#endif 307#endif
308 isBlanked = FALSE; 308 isBlanked = FALSE;
309 } 309 }
310 close( fd ); 310 close( fd );
311 } else { 311 } else {
312 qDebug("<< /dev/fb0 could not be opened >>"); 312 odebug << "<< /dev/fb0 could not be opened >>" << oendl;
313 } 313 }
314} 314}
315 315
316void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 316void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
317 switch ( e->key() ) { 317 switch ( e->key() ) {
318////////////////////////////// Zaurus keys 318////////////////////////////// Zaurus keys
319 case Key_Home: 319 case Key_Home:
320 break; 320 break;
321 case Key_F9: //activity 321 case Key_F9: //activity
322 break; 322 break;
323 case Key_F10: //contacts 323 case Key_F10: //contacts
324 break; 324 break;
325 case Key_F11: //menu 325 case Key_F11: //menu
326 break; 326 break;
327 case Key_F12: //home 327 case Key_F12: //home
328 qDebug("Blank here"); 328 odebug << "Blank here" << oendl;
329// mediaPlayerState->toggleBlank(); 329// mediaPlayerState->toggleBlank();
330 break; 330 break;
331 case Key_F13: //mail 331 case Key_F13: //mail
332 qDebug("Blank here"); 332 odebug << "Blank here" << oendl;
333 // mediaPlayerState->toggleBlank(); 333 // mediaPlayerState->toggleBlank();
334 break; 334 break;
335 } 335 }
336} 336}
337 337
338void MediaPlayer::cleanUp() {// this happens on closing 338void MediaPlayer::cleanUp() {// this happens on closing
339 Config cfg( "OpiePlayer" ); 339 Config cfg( "OpiePlayer" );
340 mediaPlayerState.writeConfig( cfg ); 340 mediaPlayerState.writeConfig( cfg );
341 playList.writeDefaultPlaylist( ); 341 playList.writeDefaultPlaylist( );
342 342
343// QPEApplication::grabKeyboard(); 343// QPEApplication::grabKeyboard();
344// QPEApplication::ungrabKeyboard(); 344// QPEApplication::ungrabKeyboard();
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp
index 26d5e15..95dbab5 100644
--- a/noncore/multimedia/opieplayer2/om3u.cpp
+++ b/noncore/multimedia/opieplayer2/om3u.cpp
@@ -28,68 +28,68 @@
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#include "om3u.h" 32#include "om3u.h"
33 33
34 34
35 35
36//extern PlayListWidget *playList; 36//extern PlayListWidget *playList;
37 37
38Om3u::Om3u( const QString &filePath, int mode) 38Om3u::Om3u( const QString &filePath, int mode)
39 : QStringList (){ 39 : QStringList (){
40qDebug("<<<<<<<new m3u "+filePath); 40odebug << "<<<<<<<new m3u "+filePath << oendl;
41 f.setName(filePath); 41 f.setName(filePath);
42 f.open(mode); 42 f.open(mode);
43} 43}
44 44
45Om3u::~Om3u(){} 45Om3u::~Om3u(){}
46 46
47void Om3u::readM3u() { 47void Om3u::readM3u() {
48// qDebug("<<<<<<reading m3u "+f.name()); 48// odebug << "<<<<<<reading m3u "+f.name() << oendl;
49 QTextStream t(&f); 49 QTextStream t(&f);
50 t.setEncoding(QTextStream::UnicodeUTF8); 50 t.setEncoding(QTextStream::UnicodeUTF8);
51 QString s; 51 QString s;
52 while ( !t.atEnd() ) { 52 while ( !t.atEnd() ) {
53 s=t.readLine(); 53 s=t.readLine();
54// qDebug(s); 54// odebug << s << oendl;
55 if( s.find( "#", 0, TRUE) == -1 ) { 55 if( s.find( "#", 0, TRUE) == -1 ) {
56 if( s.left(2) == "E:" || s.left(2) == "P:" ) { 56 if( s.left(2) == "E:" || s.left(2) == "P:" ) {
57 s = s.right( s.length() -2 ); 57 s = s.right( s.length() -2 );
58 QFileInfo f( s ); 58 QFileInfo f( s );
59 QString name = f.baseName(); 59 QString name = f.baseName();
60 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); 60 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 );
61 s=s.replace( QRegExp( "\\" ), "/" ); 61 s=s.replace( QRegExp( "\\" ), "/" );
62 append(s); 62 append(s);
63// qDebug(s); 63// odebug << s << oendl;
64 } else { // is url 64 } else { // is url
65 QString name; 65 QString name;
66 name = s; 66 name = s;
67 append(name); 67 append(name);
68 } 68 }
69 } 69 }
70 } 70 }
71} 71}
72 72
73void Om3u::readPls() { //it's a pls file 73void Om3u::readPls() { //it's a pls file
74 QTextStream t( &f ); 74 QTextStream t( &f );
75 t.setEncoding(QTextStream::UnicodeUTF8); 75 t.setEncoding(QTextStream::UnicodeUTF8);
76 QString s; 76 QString s;
77 while ( !t.atEnd() ) { 77 while ( !t.atEnd() ) {
78 s = t.readLine(); 78 s = t.readLine();
79 if( s.left(4) == "File" ) { 79 if( s.left(4) == "File" ) {
80 s = s.right( s.length() - s.find("=",0,true)-1 ); 80 s = s.right( s.length() - s.find("=",0,true)-1 );
81 s = s.stripWhiteSpace(); 81 s = s.stripWhiteSpace();
82 s.replace( QRegExp( "%20" )," "); 82 s.replace( QRegExp( "%20" )," ");
83// qDebug( "adding " + s + " to playlist" ); 83// odebug << "adding " + s + " to playlist" << oendl;
84 // numberofentries=2 84 // numberofentries=2
85 // File1=http 85 // File1=http
86 // Title 86 // Title
87 // Length 87 // Length
88 // Version 88 // Version
89 // File2=http 89 // File2=http
90 s = s.replace( QRegExp( "\\" ), "/" ); 90 s = s.replace( QRegExp( "\\" ), "/" );
91 QFileInfo f( s ); 91 QFileInfo f( s );
92 QString name = f.baseName(); 92 QString name = f.baseName();
93 if( name.left( 4 ) == "http" ) { 93 if( name.left( 4 ) == "http" ) {
94 name = s.right( s.length() - 7); 94 name = s.right( s.length() - 7);
95 } else { 95 } else {
@@ -105,41 +105,41 @@ void Om3u::readPls() { //it's a pls file
105 append(s); 105 append(s);
106 } 106 }
107 } 107 }
108 } 108 }
109} 109}
110 110
111void Om3u::write() { //writes list to m3u file 111void Om3u::write() { //writes list to m3u file
112 QString list; 112 QString list;
113 QTextStream t(&f); 113 QTextStream t(&f);
114 t.setEncoding(QTextStream::UnicodeUTF8); 114 t.setEncoding(QTextStream::UnicodeUTF8);
115 if(count()>0) { 115 if(count()>0) {
116 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 116 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
117// qDebug(*it); 117// odebug << *it << oendl;
118 t << *it << "\n"; 118 t << *it << "\n";
119 } 119 }
120 } 120 }
121// f.close(); 121// f.close();
122} 122}
123 123
124void Om3u::add(const QString &filePath) { //adds to m3u file 124void Om3u::add(const QString &filePath) { //adds to m3u file
125 append(filePath); 125 append(filePath);
126} 126}
127 127
128void Om3u::remove(const QString &filePath) { //removes from m3u list 128void Om3u::remove(const QString &filePath) { //removes from m3u list
129 QString list, currentFile; 129 QString list, currentFile;
130 if(count()>0) { 130 if(count()>0) {
131 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 131 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
132 currentFile=*it; 132 currentFile=*it;
133 // qDebug(*it); 133 // odebug << *it << oendl;
134 134
135 if( filePath != currentFile) 135 if( filePath != currentFile)
136 list += currentFile+"\n"; 136 list += currentFile+"\n";
137 } 137 }
138 f.writeBlock( list, list.length() ); 138 f.writeBlock( list, list.length() );
139 } 139 }
140} 140}
141 141
142void Om3u::deleteFile(const QString &/*filePath*/) {//deletes m3u file 142void Om3u::deleteFile(const QString &/*filePath*/) {//deletes m3u file
143 f.close(); 143 f.close();
144 f.remove(); 144 f.remove();
145 145
diff --git a/noncore/multimedia/opieplayer2/playlistselection.cpp b/noncore/multimedia/opieplayer2/playlistselection.cpp
index 015896f..3499837 100644
--- a/noncore/multimedia/opieplayer2/playlistselection.cpp
+++ b/noncore/multimedia/opieplayer2/playlistselection.cpp
@@ -35,46 +35,46 @@ public:
35 }; 35 };
36 36
37 const DocLnk *file() const { return fl; } 37 const DocLnk *file() const { return fl; }
38 38
39private: 39private:
40 const DocLnk *fl; 40 const DocLnk *fl;
41}; 41};
42 42
43 43
44PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) 44PlayListSelection::PlayListSelection( QWidget *parent, const char *name )
45 : QListView( parent, name ) 45 : QListView( parent, name )
46{ 46{
47// qDebug("starting playlistselector"); 47// odebug << "starting playlistselector" << oendl;
48// #ifdef USE_PLAYLIST_BACKGROUND 48// #ifdef USE_PLAYLIST_BACKGROUND
49// setStaticBackground( TRUE ); 49// setStaticBackground( TRUE );
50// setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) ); 50// setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) );
51 51
52// setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); 52// setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) );
53// #endif 53// #endif
54// addColumn("Title",236); 54// addColumn("Title",236);
55// setAllColumnsShowFocus( TRUE ); 55// setAllColumnsShowFocus( TRUE );
56 addColumn( tr( "Playlist Selection" ) ); 56 addColumn( tr( "Playlist Selection" ) );
57 header()->hide(); 57 header()->hide();
58 setSorting( -1, FALSE ); 58 setSorting( -1, FALSE );
59} 59}
60 60
61 61
62PlayListSelection::~PlayListSelection() { 62PlayListSelection::~PlayListSelection() {
63} 63}
64 64
65 65
66// #ifdef USE_PLAYLIST_BACKGROUND 66// #ifdef USE_PLAYLIST_BACKGROUND
67void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { 67void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) {
68// qDebug("drawBackground"); 68// odebug << "drawBackground" << oendl;
69 p->fillRect( r, QBrush( white ) ); 69 p->fillRect( r, QBrush( white ) );
70// QImage logo = Resource::loadImage( "launcher/opielogo" ); 70// QImage logo = Resource::loadImage( "launcher/opielogo" );
71// if ( !logo.isNull() ) 71// if ( !logo.isNull() )
72// p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); 72// p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo );
73} 73}
74// #endif 74// #endif
75 75
76 76
77void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { 77void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) {
78 if ( event->state() == QMouseEvent::LeftButton ) { 78 if ( event->state() == QMouseEvent::LeftButton ) {
79 QListViewItem *currentItem = selectedItem(); 79 QListViewItem *currentItem = selectedItem();
80 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); 80 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) );
@@ -175,32 +175,32 @@ bool PlayListSelection::last() {
175 175
176void PlayListSelection::unSelect() 176void PlayListSelection::unSelect()
177{ 177{
178 //QListViewItem *item = selectedItem(); 178 //QListViewItem *item = selectedItem();
179 setSelected( currentItem(), FALSE); 179 setSelected( currentItem(), FALSE);
180} 180}
181 181
182void PlayListSelection::writeCurrent( Config& cfg ) { 182void PlayListSelection::writeCurrent( Config& cfg ) {
183 cfg.setGroup("PlayList"); 183 cfg.setGroup("PlayList");
184 QListViewItem *item = selectedItem(); 184 QListViewItem *item = selectedItem();
185 if ( item ) 185 if ( item )
186 cfg.writeEntry("current", item->text(0) ); 186 cfg.writeEntry("current", item->text(0) );
187 qDebug(item->text(0)); 187 odebug << item->text(0) << oendl;
188 188
189} 189}
190 190
191void PlayListSelection::setSelectedItem(const QString &strk ) { 191void PlayListSelection::setSelectedItem(const QString &strk ) {
192 192
193 unSelect(); 193 unSelect();
194 QListViewItemIterator it( this ); 194 QListViewItemIterator it( this );
195 for ( ; it.current(); ++it ) { 195 for ( ; it.current(); ++it ) {
196// qDebug( it.current()->text(0)); 196// odebug << it.current()->text(0) << oendl;
197 if( strk == it.current()->text(0)) { 197 if( strk == it.current()->text(0)) {
198// qDebug( "We have a match "+strk); 198// odebug << "We have a match "+strk << oendl;
199 setSelected( it.current(), TRUE); 199 setSelected( it.current(), TRUE);
200 ensureItemVisible( it.current() ); 200 ensureItemVisible( it.current() );
201 return; 201 return;
202 } 202 }
203 } 203 }
204// setSelected( item, TRUE ); 204// setSelected( item, TRUE );
205// ensureItemVisible( selectedItem() ); 205// ensureItemVisible( selectedItem() );
206} 206}
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 4460833..956d206 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -173,29 +173,29 @@ void PlayListWidget::initializeStates() {
173 d->tbShuffle->setOn( mediaPlayerState->isShuffled() ); 173 d->tbShuffle->setOn( mediaPlayerState->isShuffled() );
174 d->playListFrame->show(); 174 d->playListFrame->show();
175} 175}
176 176
177void PlayListWidget::writeDefaultPlaylist() { 177void PlayListWidget::writeDefaultPlaylist() {
178 178
179 Config config( "OpiePlayer" ); 179 Config config( "OpiePlayer" );
180 config.setGroup( "PlayList" ); 180 config.setGroup( "PlayList" );
181 QString filename=QPEApplication::documentDir() + "/default.m3u"; 181 QString filename=QPEApplication::documentDir() + "/default.m3u";
182 QString currentString = config.readEntry( "CurrentPlaylist", filename); 182 QString currentString = config.readEntry( "CurrentPlaylist", filename);
183 if( currentString == filename) { 183 if( currentString == filename) {
184 Om3u *m3uList; 184 Om3u *m3uList;
185 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); 185 // odebug << "<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>" << oendl;
186 if( d->selectedFiles->first() ) { 186 if( d->selectedFiles->first() ) {
187 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); 187 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
188 do { 188 do {
189 // qDebug(d->selectedFiles->current()->file()); 189 // odebug << d->selectedFiles->current()->file() << oendl;
190 m3uList->add( d->selectedFiles->current()->file() ); 190 m3uList->add( d->selectedFiles->current()->file() );
191 } 191 }
192 while ( d->selectedFiles->next() ); 192 while ( d->selectedFiles->next() );
193 193
194 m3uList->write(); 194 m3uList->write();
195 m3uList->close(); 195 m3uList->close();
196 delete m3uList; 196 delete m3uList;
197 197
198 } 198 }
199 } 199 }
200} 200}
201 201
@@ -316,25 +316,25 @@ void PlayListWidget::addAllVideoToList() {
316 filename = videoIt.current()->text(3); 316 filename = videoIt.current()->text(3);
317 lnk.setName( QFileInfo(filename).baseName() ); //sets name 317 lnk.setName( QFileInfo(filename).baseName() ); //sets name
318 lnk.setFile( filename ); //sets file name 318 lnk.setFile( filename ); //sets file name
319 d->selectedFiles->addToSelection( lnk); 319 d->selectedFiles->addToSelection( lnk);
320 } 320 }
321 tabWidget->setCurrentPage(0); 321 tabWidget->setCurrentPage(0);
322 writeCurrentM3u(); 322 writeCurrentM3u();
323 d->selectedFiles->first(); 323 d->selectedFiles->first();
324} 324}
325 325
326 326
327void PlayListWidget::setDocument( const QString& fileref ) { 327void PlayListWidget::setDocument( const QString& fileref ) {
328 // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); 328 // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl;
329 fromSetDocument = TRUE; 329 fromSetDocument = TRUE;
330 QFileInfo fileInfo(fileref); 330 QFileInfo fileInfo(fileref);
331 331
332 if ( !fileInfo.exists() ) { 332 if ( !fileInfo.exists() ) {
333 QMessageBox::warning( this, tr( "Invalid File" ), 333 QMessageBox::warning( this, tr( "Invalid File" ),
334 tr( "There was a problem in getting the file." ) ); 334 tr( "There was a problem in getting the file." ) );
335 return; 335 return;
336 } 336 }
337 337
338 clearList(); 338 clearList();
339 QString extension = fileInfo.extension(false); 339 QString extension = fileInfo.extension(false);
340 340
@@ -392,25 +392,25 @@ bool PlayListWidget::prev() {
392 if ( mediaPlayerState->isLooping() ) { 392 if ( mediaPlayerState->isLooping() ) {
393 return d->selectedFiles->last(); 393 return d->selectedFiles->last();
394 } else { 394 } else {
395 return FALSE; 395 return FALSE;
396 } 396 }
397 } 397 }
398 return TRUE; 398 return TRUE;
399 } 399 }
400} 400}
401 401
402 402
403bool PlayListWidget::next() { 403bool PlayListWidget::next() {
404//qDebug("<<<<<<<<<<<<next()"); 404//odebug << "<<<<<<<<<<<<next()" << oendl;
405 if ( mediaPlayerState->isShuffled() ) { 405 if ( mediaPlayerState->isShuffled() ) {
406 return prev(); 406 return prev();
407 } else { 407 } else {
408 if ( !d->selectedFiles->next() ) { 408 if ( !d->selectedFiles->next() ) {
409 if ( mediaPlayerState->isLooping() ) { 409 if ( mediaPlayerState->isLooping() ) {
410 return d->selectedFiles->first(); 410 return d->selectedFiles->first();
411 } else { 411 } else {
412 return FALSE; 412 return FALSE;
413 } 413 }
414 } 414 }
415 return TRUE; 415 return TRUE;
416 } 416 }
@@ -603,25 +603,25 @@ bool PlayListWidget::inFileListMode() const
603 return tab == AudioFiles || tab == VideoFiles; 603 return tab == AudioFiles || tab == VideoFiles;
604} 604}
605 605
606void PlayListWidget::openURL() { 606void PlayListWidget::openURL() {
607 // http://66.28.164.33:2080 607 // http://66.28.164.33:2080
608 // http://somafm.com/star0242.m3u 608 // http://somafm.com/star0242.m3u
609 QString filename, name; 609 QString filename, name;
610 InputDialog *fileDlg; 610 InputDialog *fileDlg;
611 fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0); 611 fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0);
612 fileDlg->exec(); 612 fileDlg->exec();
613 if( fileDlg->result() == 1 ) { 613 if( fileDlg->result() == 1 ) {
614 filename = fileDlg->text(); 614 filename = fileDlg->text();
615 qDebug( "Selected filename is " + filename ); 615 odebug << "Selected filename is " + filename << oendl;
616 // Om3u *m3uList; 616 // Om3u *m3uList;
617 DocLnk lnk; 617 DocLnk lnk;
618 Config cfg( "OpiePlayer" ); 618 Config cfg( "OpiePlayer" );
619 cfg.setGroup("PlayList"); 619 cfg.setGroup("PlayList");
620 620
621 if(filename.left(4) == "http") { 621 if(filename.left(4) == "http") {
622 QString m3uFile, m3uFilePath; 622 QString m3uFile, m3uFilePath;
623 if(filename.find(":",8,TRUE) != -1) { //found a port 623 if(filename.find(":",8,TRUE) != -1) { //found a port
624 m3uFile = filename.left( filename.find( ":",8,TRUE)); 624 m3uFile = filename.left( filename.find( ":",8,TRUE));
625 m3uFile = m3uFile.right( 7); 625 m3uFile = m3uFile.right( 7);
626 } else if(filename.left(4) == "http"){ 626 } else if(filename.left(4) == "http"){
627 m3uFile=filename; 627 m3uFile=filename;
@@ -679,56 +679,56 @@ void PlayListWidget::openFile() {
679 679
680 QString str = OFileDialog::getOpenFileName( 1, 680 QString str = OFileDialog::getOpenFileName( 1,
681 cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", 681 cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"",
682 types, 0 ); 682 types, 0 );
683 683
684 if(str.left(2) == "//") { 684 if(str.left(2) == "//") {
685 str=str.right(str.length()-1); 685 str=str.right(str.length()-1);
686 } 686 }
687 cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() ); 687 cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() );
688 688
689 if( !str.isEmpty() ) { 689 if( !str.isEmpty() ) {
690 690
691 qDebug( "Selected filename is " + str ); 691 odebug << "Selected filename is " + str << oendl;
692 filename = str; 692 filename = str;
693 DocLnk lnk; 693 DocLnk lnk;
694 694
695 if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { 695 if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) {
696 readListFromFile( filename ); 696 readListFromFile( filename );
697 } else { 697 } else {
698 lnk.setName( QFileInfo(filename).baseName() ); //sets name 698 lnk.setName( QFileInfo(filename).baseName() ); //sets name
699 lnk.setFile( filename ); //sets file name 699 lnk.setFile( filename ); //sets file name
700 d->selectedFiles->addToSelection( lnk ); 700 d->selectedFiles->addToSelection( lnk );
701 writeCurrentM3u(); 701 writeCurrentM3u();
702 d->selectedFiles->setSelectedItem( lnk.name() ); 702 d->selectedFiles->setSelectedItem( lnk.name() );
703 } 703 }
704 } 704 }
705} 705}
706 706
707 707
708void PlayListWidget::readListFromFile( const QString &filename ) { 708void PlayListWidget::readListFromFile( const QString &filename ) {
709 qDebug( "read list filename " + filename ); 709 odebug << "read list filename " + filename << oendl;
710 QFileInfo fi(filename); 710 QFileInfo fi(filename);
711 Om3u *m3uList; 711 Om3u *m3uList;
712 QString s, name; 712 QString s, name;
713 m3uList = new Om3u( filename, IO_ReadOnly ); 713 m3uList = new Om3u( filename, IO_ReadOnly );
714 if(fi.extension(false).find("m3u",0,false) != -1 ) 714 if(fi.extension(false).find("m3u",0,false) != -1 )
715 m3uList->readM3u(); 715 m3uList->readM3u();
716 else if(fi.extension(false).find("pls",0,false) != -1 ) 716 else if(fi.extension(false).find("pls",0,false) != -1 )
717 m3uList->readPls(); 717 m3uList->readPls();
718 718
719 DocLnk lnk; 719 DocLnk lnk;
720 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 720 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
721 s = *it; 721 s = *it;
722 // qDebug(s); 722 // odebug << s << oendl;
723 if(s.left(4)=="http") { 723 if(s.left(4)=="http") {
724 lnk.setName( s ); //sets file name 724 lnk.setName( s ); //sets file name
725 lnk.setIcon("opieplayer2/musicfile"); 725 lnk.setIcon("opieplayer2/musicfile");
726 lnk.setFile( s ); //sets file name 726 lnk.setFile( s ); //sets file name
727 727
728 } else { //is file 728 } else { //is file
729 lnk.setName( QFileInfo(s).baseName()); 729 lnk.setName( QFileInfo(s).baseName());
730 if(s.left(1) != "/") { 730 if(s.left(1) != "/") {
731 731
732 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); 732 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s);
733 } else { 733 } else {
734 lnk.setFile( s); 734 lnk.setFile( s);
@@ -744,39 +744,39 @@ void PlayListWidget::readListFromFile( const QString &filename ) {
744 currentPlayList=filename; 744 currentPlayList=filename;
745 745
746 m3uList->close(); 746 m3uList->close();
747 delete m3uList; 747 delete m3uList;
748 748
749 d->selectedFiles->setSelectedItem( s); 749 d->selectedFiles->setSelectedItem( s);
750 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); 750 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName());
751 751
752} 752}
753 753
754// writes current playlist to current m3u file */ 754// writes current playlist to current m3u file */
755 void PlayListWidget::writeCurrentM3u() { 755 void PlayListWidget::writeCurrentM3u() {
756 qDebug("writing to current m3u"); 756 odebug << "writing to current m3u" << oendl;
757 Config cfg( "OpiePlayer" ); 757 Config cfg( "OpiePlayer" );
758 cfg.setGroup("PlayList"); 758 cfg.setGroup("PlayList");
759 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 759 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
760 760
761 Om3u *m3uList; 761 Om3u *m3uList;
762 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); 762 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate );
763 if( d->selectedFiles->first()) { 763 if( d->selectedFiles->first()) {
764 764
765 do { 765 do {
766 // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); 766 // odebug << "add writeCurrentM3u " +d->selectedFiles->current()->file() << oendl;
767 m3uList->add( d->selectedFiles->current()->file() ); 767 m3uList->add( d->selectedFiles->current()->file() );
768 } 768 }
769 while ( d->selectedFiles->next() ); 769 while ( d->selectedFiles->next() );
770 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); 770 // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl;
771 m3uList->write(); 771 m3uList->write();
772 m3uList->close(); 772 m3uList->close();
773 } 773 }
774 delete m3uList; 774 delete m3uList;
775 775
776 } 776 }
777 777
778 /* 778 /*
779 writes current playlist to m3u file */ 779 writes current playlist to m3u file */
780void PlayListWidget::writem3u() { 780void PlayListWidget::writem3u() {
781 //InputDilog *fileDlg; 781 //InputDilog *fileDlg;
782 //fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); 782 //fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
@@ -803,63 +803,63 @@ void PlayListWidget::writem3u() {
803 cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", 803 cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"",
804 types, 0 ); 804 types, 0 );
805 if(str.left(2) == "//") str=str.right(str.length()-1); 805 if(str.left(2) == "//") str=str.right(str.length()-1);
806 cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); 806 cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath());
807 807
808 808
809 QString name, filename, list; 809 QString name, filename, list;
810 Om3u *m3uList; 810 Om3u *m3uList;
811 811
812 if( !str.isEmpty() ) { 812 if( !str.isEmpty() ) {
813 name = str; 813 name = str;
814 // name = fileDlg->text(); 814 // name = fileDlg->text();
815// qDebug( filename ); 815// odebug << filename << oendl;
816 if( name.find("/",0,true) != -1) {// assume they specify a file path 816 if( name.find("/",0,true) != -1) {// assume they specify a file path
817 filename = name; 817 filename = name;
818 name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); 818 name = name.right(name.length()- name.findRev("/",-1,true) - 1 );
819 } 819 }
820 else //otherwise dump it somewhere noticable 820 else //otherwise dump it somewhere noticable
821 filename = QPEApplication::documentDir() + "/" + name; 821 filename = QPEApplication::documentDir() + "/" + name;
822 822
823 if( filename.right( 3 ) != "m3u" ) //needs filename extension 823 if( filename.right( 3 ) != "m3u" ) //needs filename extension
824 filename += ".m3u"; 824 filename += ".m3u";
825 825
826 if( d->selectedFiles->first()) { //ramble through playlist view 826 if( d->selectedFiles->first()) { //ramble through playlist view
827 m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate); 827 m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate);
828 828
829 do { 829 do {
830 m3uList->add( d->selectedFiles->current()->file()); 830 m3uList->add( d->selectedFiles->current()->file());
831 } 831 }
832 while ( d->selectedFiles->next() ); 832 while ( d->selectedFiles->next() );
833 // qDebug( list ); 833 // odebug << list << oendl;
834 m3uList->write(); 834 m3uList->write();
835 m3uList->close(); 835 m3uList->close();
836 delete m3uList; 836 delete m3uList;
837 837
838 //delete fileDlg; 838 //delete fileDlg;
839 839
840 DocLnk lnk; 840 DocLnk lnk;
841 lnk.setFile( filename); 841 lnk.setFile( filename);
842 lnk.setIcon("opieplayer2/playlist2"); 842 lnk.setIcon("opieplayer2/playlist2");
843 lnk.setName( name); //sets file name 843 lnk.setName( name); //sets file name
844 844
845 // qDebug(filename); 845 // odebug << filename << oendl;
846 Config config( "OpiePlayer" ); 846 Config config( "OpiePlayer" );
847 config.setGroup( "PlayList" ); 847 config.setGroup( "PlayList" );
848 848
849 config.writeEntry("CurrentPlaylist",filename); 849 config.writeEntry("CurrentPlaylist",filename);
850 currentPlayList=filename; 850 currentPlayList=filename;
851 851
852 if(!lnk.writeLink()) { 852 if(!lnk.writeLink()) {
853 qDebug("Writing doclink did not work"); 853 odebug << "Writing doclink did not work" << oendl;
854 } 854 }
855 855
856 setCaption(tr("OpiePlayer: ") + name); 856 setCaption(tr("OpiePlayer: ") + name);
857 } 857 }
858 } 858 }
859} 859}
860 860
861void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { 861void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
862 switch ( e->key() ) { 862 switch ( e->key() ) {
863 ////////////////////////////// Zaurus keys 863 ////////////////////////////// Zaurus keys
864 case Key_F9: //activity 864 case Key_F9: //activity
865 // if(audioUI->isHidden()) 865 // if(audioUI->isHidden())
@@ -875,25 +875,25 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
875 // doBlank(); 875 // doBlank();
876 break; 876 break;
877 case Key_F13: //mail 877 case Key_F13: //mail
878 // doUnblank(); 878 // doUnblank();
879 break; 879 break;
880 case Key_Q: //add to playlist 880 case Key_Q: //add to playlist
881 addSelected(); 881 addSelected();
882 break; 882 break;
883 case Key_R: //remove from playlist 883 case Key_R: //remove from playlist
884 removeSelected(); 884 removeSelected();
885 break; 885 break;
886 // case Key_P: //play 886 // case Key_P: //play
887 // qDebug("Play"); 887 // odebug << "Play" << oendl;
888 // playSelected(); 888 // playSelected();
889 // break; 889 // break;
890 case Key_Space: 890 case Key_Space:
891 // playSelected(); puh 891 // playSelected(); puh
892 break; 892 break;
893 case Key_1: 893 case Key_1:
894 tabWidget->setCurrentPage( 0 ); 894 tabWidget->setCurrentPage( 0 );
895 break; 895 break;
896 case Key_2: 896 case Key_2:
897 tabWidget->setCurrentPage( 1 ); 897 tabWidget->setCurrentPage( 1 );
898 break; 898 break;
899 case Key_3: 899 case Key_3:
@@ -905,25 +905,25 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
905 case Key_Down: 905 case Key_Down:
906 if ( !d->selectedFiles->next() ) 906 if ( !d->selectedFiles->next() )
907 d->selectedFiles->first(); 907 d->selectedFiles->first();
908 break; 908 break;
909 case Key_Up: 909 case Key_Up:
910 if ( !d->selectedFiles->prev() ) 910 if ( !d->selectedFiles->prev() )
911 // d->selectedFiles->last(); 911 // d->selectedFiles->last();
912 break; 912 break;
913 } 913 }
914} 914}
915 915
916void PlayListWidget::pmViewActivated(int index) { 916void PlayListWidget::pmViewActivated(int index) {
917// qDebug("%d", index); 917// odebug << "" << index << "" << oendl;
918 switch(index) { 918 switch(index) {
919 case -16: 919 case -16:
920 { 920 {
921 mediaPlayerState->toggleFullscreen(); 921 mediaPlayerState->toggleFullscreen();
922 bool b=mediaPlayerState->isFullscreen(); 922 bool b=mediaPlayerState->isFullscreen();
923 pmView->setItemChecked( index, b); 923 pmView->setItemChecked( index, b);
924 Config cfg( "OpiePlayer" ); 924 Config cfg( "OpiePlayer" );
925 cfg.writeEntry( "FullScreen", b ); 925 cfg.writeEntry( "FullScreen", b );
926 } 926 }
927 break; 927 break;
928 }; 928 };
929} 929}
@@ -935,25 +935,25 @@ void PlayListWidget::populateSkinsMenu() {
935 Config cfg( "OpiePlayer" ); 935 Config cfg( "OpiePlayer" );
936 cfg.setGroup("Options" ); 936 cfg.setGroup("Options" );
937 QString skin = cfg.readEntry( "Skin", "default" ); 937 QString skin = cfg.readEntry( "Skin", "default" );
938 938
939 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); 939 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
940 skinsDir.setFilter( QDir::Dirs ); 940 skinsDir.setFilter( QDir::Dirs );
941 skinsDir.setSorting(QDir::Name ); 941 skinsDir.setSorting(QDir::Name );
942 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 942 const QFileInfoList *skinslist = skinsDir.entryInfoList();
943 QFileInfoListIterator it( *skinslist ); 943 QFileInfoListIterator it( *skinslist );
944 QFileInfo *fi; 944 QFileInfo *fi;
945 while ( ( fi = it.current() ) ) { 945 while ( ( fi = it.current() ) ) {
946 skinName = fi->fileName(); 946 skinName = fi->fileName();
947// qDebug( fi->fileName() ); 947// odebug << fi->fileName() << oendl;
948 if( skinName != "." && skinName != ".." && skinName !="CVS" ) { 948 if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
949 item = skinsMenu->insertItem( fi->fileName() ) ; 949 item = skinsMenu->insertItem( fi->fileName() ) ;
950 } 950 }
951 if( skinName == "default" ) { 951 if( skinName == "default" ) {
952 defaultSkinIndex = item; 952 defaultSkinIndex = item;
953 } 953 }
954 if( skinName == skin ) { 954 if( skinName == skin ) {
955 skinsMenu->setItemChecked( item, TRUE ); 955 skinsMenu->setItemChecked( item, TRUE );
956 } 956 }
957 ++it; 957 ++it;
958 } 958 }
959} 959}
@@ -991,25 +991,25 @@ PlayListWidget::Entry PlayListWidget::currentEntry() const
991 return Entry( lnk->name(), lnk->file() ); 991 return Entry( lnk->name(), lnk->file() );
992 } 992 }
993 993
994 return Entry( currentFileListPathName() ); 994 return Entry( currentFileListPathName() );
995} 995}
996 996
997QString PlayListWidget::currentFileListPathName() const { 997QString PlayListWidget::currentFileListPathName() const {
998 return currentFileListView->currentItem()->text( 3 ); 998 return currentFileListView->currentItem()->text( 3 );
999} 999}
1000 1000
1001 1001
1002void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { 1002void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
1003 qDebug("qcop message "+msg ); 1003 odebug << "qcop message "+msg << oendl;
1004 QDataStream stream ( data, IO_ReadOnly ); 1004 QDataStream stream ( data, IO_ReadOnly );
1005 if ( msg == "play()" ) { //plays current selection 1005 if ( msg == "play()" ) { //plays current selection
1006 btnPlay( true); 1006 btnPlay( true);
1007 } else if ( msg == "stop()" ) { 1007 } else if ( msg == "stop()" ) {
1008 mediaPlayerState->setPlaying( false); 1008 mediaPlayerState->setPlaying( false);
1009 } else if ( msg == "togglePause()" ) { 1009 } else if ( msg == "togglePause()" ) {
1010 mediaPlayerState->togglePaused(); 1010 mediaPlayerState->togglePaused();
1011 } else if ( msg == "next()" ) { //select next in list 1011 } else if ( msg == "next()" ) { //select next in list
1012 mediaPlayerState->setNext(); 1012 mediaPlayerState->setNext();
1013 } else if ( msg == "prev()" ) { //select previous in list 1013 } else if ( msg == "prev()" ) { //select previous in list
1014 mediaPlayerState->setPrev(); 1014 mediaPlayerState->setPrev();
1015 } else if ( msg == "toggleLooping()" ) { //loop or not loop 1015 } else if ( msg == "toggleLooping()" ) { //loop or not loop
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index 2ff190d..922f9d7 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -174,20 +174,20 @@ PlayListWidgetGui::PlayListWidgetGui(QWidget* parent, const char* name )
174PlayListWidgetGui::~PlayListWidgetGui() { 174PlayListWidgetGui::~PlayListWidgetGui() {
175} 175}
176 176
177void PlayListWidgetGui::setView( char view ) { 177void PlayListWidgetGui::setView( char view ) {
178 if ( view == 'l' ) 178 if ( view == 'l' )
179 showMaximized(); 179 showMaximized();
180 else 180 else
181 hide(); 181 hide();
182} 182}
183 183
184 184
185void PlayListWidgetGui::setActiveWindow() { 185void PlayListWidgetGui::setActiveWindow() {
186 // qDebug("SETTING active window"); 186 // odebug << "SETTING active window" << oendl;
187 // When we get raised we need to ensure that it switches views 187 // When we get raised we need to ensure that it switches views
188 MediaPlayerState::DisplayType origDisplayType = mediaPlayerState->displayType(); 188 MediaPlayerState::DisplayType origDisplayType = mediaPlayerState->displayType();
189 mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); // invalidate 189 mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); // invalidate
190 mediaPlayerState->setDisplayType( origDisplayType ); // now switch back 190 mediaPlayerState->setDisplayType( origDisplayType ); // now switch back
191} 191}
192 192
193 193
diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp
index 7c38983..84f5f87 100644
--- a/noncore/multimedia/opieplayer2/skin.cpp
+++ b/noncore/multimedia/opieplayer2/skin.cpp
@@ -169,29 +169,29 @@ SkinCache::SkinCache()
169 // ... and one background pixmap 169 // ... and one background pixmap
170 m_backgroundPixmapCache.setMaxCost( 1 ); 170 m_backgroundPixmapCache.setMaxCost( 1 );
171} 171}
172 172
173SkinData *SkinCache::lookupAndTake( const QString &skinPath, const QString &fileNameInfix ) 173SkinData *SkinCache::lookupAndTake( const QString &skinPath, const QString &fileNameInfix )
174{ 174{
175 QString key = skinPath + fileNameInfix; 175 QString key = skinPath + fileNameInfix;
176 176
177 SkinData *data = m_cache.take( key ); 177 SkinData *data = m_cache.take( key );
178 if ( !data ) 178 if ( !data )
179 data = new SkinData; 179 data = new SkinData;
180 else 180 else
181 qDebug( "SkinCache: hit" ); 181 odebug << "SkinCache: hit" << oendl;
182 182
183 QPixmap *bgPixmap = m_backgroundPixmapCache.find( skinPath ); 183 QPixmap *bgPixmap = m_backgroundPixmapCache.find( skinPath );
184 if ( bgPixmap ) { 184 if ( bgPixmap ) {
185 qDebug( "SkinCache: hit on bgpixmap" ); 185 odebug << "SkinCache: hit on bgpixmap" << oendl;
186 data->backgroundPixmap = *bgPixmap; 186 data->backgroundPixmap = *bgPixmap;
187 } 187 }
188 else 188 else
189 data->backgroundPixmap = QPixmap(); 189 data->backgroundPixmap = QPixmap();
190 190
191 return data; 191 return data;
192} 192}
193 193
194void SkinCache::store( const QString &skinPath, const QString &fileNameInfix, SkinData *data ) 194void SkinCache::store( const QString &skinPath, const QString &fileNameInfix, SkinData *data )
195{ 195{
196 QPixmap *backgroundPixmap = new QPixmap( data->backgroundPixmap ); 196 QPixmap *backgroundPixmap = new QPixmap( data->backgroundPixmap );
197 197
@@ -209,114 +209,114 @@ void SkinCache::store( const QString &skinPath, const QString &fileNameInfix, Sk
209} 209}
210 210
211SkinLoader::IncrementalLoader::IncrementalLoader( const Info &info ) 211SkinLoader::IncrementalLoader::IncrementalLoader( const Info &info )
212 : m_skin( info.skinName, info.fileNameInfix ), m_info( info ) 212 : m_skin( info.skinName, info.fileNameInfix ), m_info( info )
213{ 213{
214 m_currentState = LoadBackgroundPixmap; 214 m_currentState = LoadBackgroundPixmap;
215} 215}
216 216
217SkinLoader::IncrementalLoader::LoaderResult SkinLoader::IncrementalLoader::loadStep() 217SkinLoader::IncrementalLoader::LoaderResult SkinLoader::IncrementalLoader::loadStep()
218{ 218{
219 switch ( m_currentState ) { 219 switch ( m_currentState ) {
220 case LoadBackgroundPixmap: 220 case LoadBackgroundPixmap:
221 qDebug( "load bgpixmap" ); 221 odebug << "load bgpixmap" << oendl;
222 m_skin.backgroundPixmap(); 222 m_skin.backgroundPixmap();
223 m_currentState = LoadButtonUpImage; 223 m_currentState = LoadButtonUpImage;
224 break; 224 break;
225 case LoadButtonUpImage: 225 case LoadButtonUpImage:
226 qDebug( "load upimage" ); 226 odebug << "load upimage" << oendl;
227 m_skin.buttonUpImage(); 227 m_skin.buttonUpImage();
228 m_currentState = LoadButtonDownImage; 228 m_currentState = LoadButtonDownImage;
229 break; 229 break;
230 case LoadButtonDownImage: 230 case LoadButtonDownImage:
231 qDebug( "load downimage" ); 231 odebug << "load downimage" << oendl;
232 m_skin.buttonDownImage(); 232 m_skin.buttonDownImage();
233 m_currentState = LoadButtonMasks; 233 m_currentState = LoadButtonMasks;
234 m_currentButton = 0; 234 m_currentButton = 0;
235 break; 235 break;
236 case LoadButtonMasks: 236 case LoadButtonMasks:
237 qDebug( "load button masks %i", m_currentButton ); 237 odebug << "load button masks " << m_currentButton << "" << oendl;
238 m_skin.buttonMaskImage( m_info.buttonInfo[ m_currentButton ].fileName ); 238 m_skin.buttonMaskImage( m_info.buttonInfo[ m_currentButton ].fileName );
239 239
240 m_currentButton++; 240 m_currentButton++;
241 if ( m_currentButton >= m_info.buttonCount ) 241 if ( m_currentButton >= m_info.buttonCount )
242 m_currentState = LoadButtonMask; 242 m_currentState = LoadButtonMask;
243 243
244 break; 244 break;
245 case LoadButtonMask: 245 case LoadButtonMask:
246 qDebug( "load whole mask" ); 246 odebug << "load whole mask" << oendl;
247 m_skin.buttonMask( m_info.buttonInfo, m_info.buttonCount ); 247 m_skin.buttonMask( m_info.buttonInfo, m_info.buttonCount );
248 return LoadingCompleted; 248 return LoadingCompleted;
249 } 249 }
250 250
251 return MoreToCome; 251 return MoreToCome;
252} 252}
253 253
254SkinLoader::SkinLoader() 254SkinLoader::SkinLoader()
255 : m_currentLoader( 0 ), m_timerId( -1 ) 255 : m_currentLoader( 0 ), m_timerId( -1 )
256{ 256{
257} 257}
258 258
259SkinLoader::~SkinLoader() 259SkinLoader::~SkinLoader()
260{ 260{
261 qDebug( "SkinLoader::~SkinLoader()" ); 261 odebug << "SkinLoader::~SkinLoader()" << oendl;
262 killTimers(); 262 killTimers();
263 delete m_currentLoader; 263 delete m_currentLoader;
264} 264}
265 265
266void SkinLoader::schedule( const MediaWidget::GUIInfo &guiInfo ) 266void SkinLoader::schedule( const MediaWidget::GUIInfo &guiInfo )
267{ 267{
268 schedule( Skin::defaultSkinName(), guiInfo ); 268 schedule( Skin::defaultSkinName(), guiInfo );
269} 269}
270 270
271void SkinLoader::schedule( const QString &skinName, const MediaWidget::GUIInfo &guiInfo ) 271void SkinLoader::schedule( const QString &skinName, const MediaWidget::GUIInfo &guiInfo )
272{ 272{
273 pendingSkins << Info( skinName, guiInfo ); 273 pendingSkins << Info( skinName, guiInfo );
274} 274}
275 275
276void SkinLoader::start() 276void SkinLoader::start()
277{ 277{
278 assert( m_timerId == -1 ); 278 assert( m_timerId == -1 );
279 m_timerId = startTimer( 100 /* ms */ ); 279 m_timerId = startTimer( 100 /* ms */ );
280 qDebug( "SkinLoader::start() %d jobs", pendingSkins.count() ); 280 odebug << "SkinLoader::start() " << pendingSkins.count() << " jobs" << oendl;
281} 281}
282 282
283void SkinLoader::timerEvent( QTimerEvent *ev ) 283void SkinLoader::timerEvent( QTimerEvent *ev )
284{ 284{
285 if ( ev->timerId() != m_timerId ) { 285 if ( ev->timerId() != m_timerId ) {
286 QObject::timerEvent( ev ); 286 QObject::timerEvent( ev );
287 return; 287 return;
288 } 288 }
289 289
290 if ( !m_currentLoader ) { 290 if ( !m_currentLoader ) {
291 291
292 if ( pendingSkins.isEmpty() ) { 292 if ( pendingSkins.isEmpty() ) {
293 qDebug( "all jobs done" ); 293 odebug << "all jobs done" << oendl;
294 killTimer( m_timerId ); 294 killTimer( m_timerId );
295 m_timerId = -1; 295 m_timerId = -1;
296 // ### qt3: use deleteLater(); 296 // ### qt3: use deleteLater();
297 QTimer::singleShot( 0, this, SLOT( deleteMe() ) ); 297 QTimer::singleShot( 0, this, SLOT( deleteMe() ) );
298 return; 298 return;
299 } 299 }
300 300
301 Info nfo = *pendingSkins.begin(); 301 Info nfo = *pendingSkins.begin();
302 pendingSkins.remove( pendingSkins.begin() ); 302 pendingSkins.remove( pendingSkins.begin() );
303 303
304 m_currentLoader = new IncrementalLoader( nfo ); 304 m_currentLoader = new IncrementalLoader( nfo );
305 qDebug( "new loader %i jobs left", pendingSkins.count() ); 305 odebug << "new loader " << pendingSkins.count() << " jobs left" << oendl;
306 } 306 }
307 307
308 if ( m_currentLoader->loadStep() == IncrementalLoader::LoadingCompleted ) { 308 if ( m_currentLoader->loadStep() == IncrementalLoader::LoadingCompleted ) {
309 delete m_currentLoader; 309 delete m_currentLoader;
310 m_currentLoader = 0; 310 m_currentLoader = 0;
311 } 311 }
312 312
313 qDebug( "finished step" ); 313 odebug << "finished step" << oendl;
314} 314}
315 315
316void SkinLoader::deleteMe() 316void SkinLoader::deleteMe()
317{ 317{
318 delete this; 318 delete this;
319} 319}
320 320
321/* vim: et sw=4 ts=4 321/* vim: et sw=4 ts=4
322 */ 322 */
diff --git a/noncore/multimedia/opieplayer2/threadutil.cpp b/noncore/multimedia/opieplayer2/threadutil.cpp
index fb951b4..d8b8abe 100644
--- a/noncore/multimedia/opieplayer2/threadutil.cpp
+++ b/noncore/multimedia/opieplayer2/threadutil.cpp
@@ -178,34 +178,34 @@ Thread::Thread()
178 178
179Thread::~Thread() 179Thread::~Thread()
180{ 180{
181 assert( d->isRunning == false ); 181 assert( d->isRunning == false );
182 delete d; 182 delete d;
183} 183}
184 184
185void Thread::start() 185void Thread::start()
186{ 186{
187 AutoLock lock( d->guard ); 187 AutoLock lock( d->guard );
188 188
189 if ( d->isRunning ) { 189 if ( d->isRunning ) {
190 qDebug( "ThreadUtil::Thread::start() called for running thread." ); 190 odebug << "ThreadUtil::Thread::start() called for running thread." << oendl;
191 return; 191 return;
192 } 192 }
193 193
194 pthread_attr_t attributes; 194 pthread_attr_t attributes;
195 pthread_attr_init( &attributes ); 195 pthread_attr_init( &attributes );
196 pthread_attr_setscope( &attributes, PTHREAD_SCOPE_SYSTEM ); 196 pthread_attr_setscope( &attributes, PTHREAD_SCOPE_SYSTEM );
197 int err = pthread_create( &d->self, &attributes, start_thread, ( void* )d ); 197 int err = pthread_create( &d->self, &attributes, start_thread, ( void* )d );
198 if ( err != 0 ) { 198 if ( err != 0 ) {
199 qDebug( "ThreadUtil::Thread::start() : can't create thread: %s", strerror( err ) ); 199 odebug << "ThreadUtil::Thread::start() : can't create thread: " << strerror( err ) << "" << oendl;
200 pthread_attr_destroy( &attributes ); 200 pthread_attr_destroy( &attributes );
201 return; 201 return;
202 } 202 }
203 pthread_attr_destroy( &attributes ); 203 pthread_attr_destroy( &attributes );
204} 204}
205 205
206void Thread::terminate() 206void Thread::terminate()
207{ 207{
208 AutoLock lock( d->guard ); 208 AutoLock lock( d->guard );
209 if ( !d->isRunning ) 209 if ( !d->isRunning )
210 return; 210 return;
211 211
@@ -275,25 +275,25 @@ ChannelMessage::ChannelMessage( int type )
275} 275}
276 276
277ChannelMessage::~ChannelMessage() 277ChannelMessage::~ChannelMessage()
278{ 278{
279 if ( m_guard.isLocked() ) 279 if ( m_guard.isLocked() )
280 m_guard.unlock(); 280 m_guard.unlock();
281} 281}
282 282
283void ChannelMessage::reply() 283void ChannelMessage::reply()
284{ 284{
285 if ( !m_isCall ) 285 if ( !m_isCall )
286 { 286 {
287 qDebug( "ChannelMessage::reply() - can't reply oneway message!" ); 287 odebug << "ChannelMessage::reply() - can't reply oneway message!" << oendl;
288 return; 288 return;
289 } 289 }
290 290
291 if ( m_inEventHandler ) 291 if ( m_inEventHandler )
292 { 292 {
293 m_replied = true; 293 m_replied = true;
294 return; 294 return;
295 } 295 }
296 296
297 m_condition.wakeOne(); 297 m_condition.wakeOne();
298 m_guard.unlock(); 298 m_guard.unlock();
299} 299}
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 8f11b2e..94f99f8 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -84,43 +84,43 @@ XineControl::~XineControl() {
84 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 84 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
85 } 85 }
86#endif 86#endif
87 delete libXine; 87 delete libXine;
88} 88}
89 89
90void XineControl::play( const QString& fileName ) { 90void XineControl::play( const QString& fileName ) {
91 91
92 hasVideoChannel = FALSE; 92 hasVideoChannel = FALSE;
93 hasAudioChannel = FALSE; 93 hasAudioChannel = FALSE;
94 m_fileName = fileName; 94 m_fileName = fileName;
95 95
96 qDebug("<<FILENAME: " + fileName + ">>>>"); 96 odebug << "<<FILENAME: " + fileName + ">>>>" << oendl;
97 97
98 if ( !libXine->play( fileName, 0, 0 ) ) { 98 if ( !libXine->play( fileName, 0, 0 ) ) {
99 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 99 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
100 // toggle stop so the the play button is reset 100 // toggle stop so the the play button is reset
101 mediaPlayerState.setPlaying( false ); 101 mediaPlayerState.setPlaying( false );
102 return; 102 return;
103 } 103 }
104 mediaPlayerState.setPlaying( true ); 104 mediaPlayerState.setPlaying( true );
105 105
106 MediaPlayerState::DisplayType displayType; 106 MediaPlayerState::DisplayType displayType;
107 if ( !libXine->hasVideo() ) { 107 if ( !libXine->hasVideo() ) {
108 displayType = MediaPlayerState::Audio; 108 displayType = MediaPlayerState::Audio;
109 qDebug("HAS AUDIO"); 109 odebug << "HAS AUDIO" << oendl;
110 libXine->setShowVideo( false ); 110 libXine->setShowVideo( false );
111 hasAudioChannel = TRUE; 111 hasAudioChannel = TRUE;
112 } else { 112 } else {
113 displayType = MediaPlayerState::Video; 113 displayType = MediaPlayerState::Video;
114 qDebug("HAS VIDEO"); 114 odebug << "HAS VIDEO" << oendl;
115 libXine->setShowVideo( true ); 115 libXine->setShowVideo( true );
116 hasVideoChannel = TRUE; 116 hasVideoChannel = TRUE;
117 } 117 }
118 // determine if slider is shown 118 // determine if slider is shown
119 mediaPlayerState.setIsSeekable( libXine->isSeekable() ); 119 mediaPlayerState.setIsSeekable( libXine->isSeekable() );
120 120
121 // which gui (video / audio) 121 // which gui (video / audio)
122 mediaPlayerState.setDisplayType( displayType ); 122 mediaPlayerState.setDisplayType( displayType );
123 123
124#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 124#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
125 if ( !disabledSuspendScreenSaver ) { 125 if ( !disabledSuspendScreenSaver ) {
126 disabledSuspendScreenSaver = TRUE; 126 disabledSuspendScreenSaver = TRUE;
@@ -234,25 +234,25 @@ QString XineControl::getMetaInfo() {
234 } 234 }
235 235
236 if ( !libXine->metaInfo( 5 ).isEmpty() ) { 236 if ( !libXine->metaInfo( 5 ).isEmpty() ) {
237 returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); 237 returnString += tr( " Year: " + libXine->metaInfo( 5 ) );
238 } 238 }
239 return returnString; 239 return returnString;
240} 240}
241 241
242QString XineControl::getErrorCode() { 242QString XineControl::getErrorCode() {
243 243
244 int errorCode = libXine->error(); 244 int errorCode = libXine->error();
245 245
246 qDebug( QString("ERRORCODE: %1 ").arg(errorCode) ); 246 odebug << QString("ERRORCODE: %1 ").arg(errorCode) << oendl;
247 247
248 if ( errorCode == 1 ) { 248 if ( errorCode == 1 ) {
249 return tr( "No input plugin found for this media type" ); 249 return tr( "No input plugin found for this media type" );
250 } else if ( errorCode == 2 ) { 250 } else if ( errorCode == 2 ) {
251 return tr( "No demux plugin found for this media type" ); 251 return tr( "No demux plugin found for this media type" );
252 } else if ( errorCode == 3 ) { 252 } else if ( errorCode == 3 ) {
253 return tr( "Demuxing failed for this media type" ); 253 return tr( "Demuxing failed for this media type" );
254 } else if ( errorCode == 4 ) { 254 } else if ( errorCode == 4 ) {
255 return tr( "Malformed MRL" ); 255 return tr( "Malformed MRL" );
256 } else { 256 } else {
257 return tr( "Some other error" ); 257 return tr( "Some other error" );
258 } 258 }
diff --git a/noncore/multimedia/opierec/device.cpp b/noncore/multimedia/opierec/device.cpp
index ce49e96..5319d97 100644
--- a/noncore/multimedia/opierec/device.cpp
+++ b/noncore/multimedia/opierec/device.cpp
@@ -1,50 +1,50 @@
1// device.cpp 1// device.cpp
2 2
3#include "device.h" 3#include "device.h"
4 4
5/* OPIE */
6#include <opie2/odebug.h>
5#include <qpe/config.h> 7#include <qpe/config.h>
6#include <qpe/qcopenvelope_qws.h> 8#include <qpe/qcopenvelope_qws.h>
9using namespace Opie::Core;
7 10
8 11/* STD */
9#include <fcntl.h> 12#include <fcntl.h>
10#include <stdio.h> 13#include <stdio.h>
11#include <stdlib.h> 14#include <stdlib.h>
12#include <sys/ioctl.h> 15#include <sys/ioctl.h>
13#include <sys/soundcard.h> 16#include <sys/soundcard.h>
14#include <unistd.h> 17#include <unistd.h>
15#include<sys/wait.h> 18#include <sys/wait.h>
16// #include <sys/stat.h>
17// #include <sys/time.h>
18// #include <sys/types.h>
19#include <unistd.h> 19#include <unistd.h>
20#include <errno.h> 20#include <errno.h>
21 21
22//extern QtRec *qperec; 22//extern QtRec *qperec;
23 23
24Device::Device( QObject * parent, const char * dsp, const char * mixr, bool record ) 24Device::Device( QObject * parent, const char * dsp, const char * mixr, bool record )
25 : QObject( parent) 25 : QObject( parent)
26{ 26{
27 dspstr = (char *)dsp; 27 dspstr = (char *)dsp;
28 mixstr = (char *)mixr; 28 mixstr = (char *)mixr;
29 29
30 devForm=-1; 30 devForm=-1;
31 devCh=-1; 31 devCh=-1;
32 devRate=-1; 32 devRate=-1;
33 33
34 if( !record){ //playing 34 if( !record){ //playing
35 qDebug("setting up DSP for playing"); 35 odebug << "setting up DSP for playing" << oendl;
36 flags = O_WRONLY; 36 flags = O_WRONLY;
37 } else { //recording 37 } else { //recording
38 qDebug("setting up DSP for recording"); 38 odebug << "setting up DSP for recording" << oendl;
39 flags = O_RDWR; 39 flags = O_RDWR;
40// flags = O_RDONLY; 40// flags = O_RDONLY;
41 41
42// selectMicInput(); 42// selectMicInput();
43 43
44 } 44 }
45} 45}
46 46
47bool Device::openDsp() { 47bool Device::openDsp() {
48 if( openDevice( flags) == -1) { 48 if( openDevice( flags) == -1) {
49 perror("<<<<<<<<<<<<<<ioctl(\"Open device\")"); 49 perror("<<<<<<<<<<<<<<ioctl(\"Open device\")");
50 return false; 50 return false;
@@ -87,40 +87,40 @@ int Device::getInVolume() {
87 87
88void Device::changedOutVolume(int vol) { 88void Device::changedOutVolume(int vol) {
89 int level = (vol << 8) + vol; 89 int level = (vol << 8) + vol;
90 int fd = 0; 90 int fd = 0;
91 if ((fd = open("/dev/mixer", O_RDWR))>=0) { 91 if ((fd = open("/dev/mixer", O_RDWR))>=0) {
92 if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_VOLUME), &level) == -1) 92 if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_VOLUME), &level) == -1)
93 perror("ioctl(\"MIXER_IN_WRITE\")"); 93 perror("ioctl(\"MIXER_IN_WRITE\")");
94 94
95 Config cfg("qpe"); 95 Config cfg("qpe");
96 cfg.setGroup("Volume"); 96 cfg.setGroup("Volume");
97 cfg.writeEntry("VolumePercent", QString::number( vol )); 97 cfg.writeEntry("VolumePercent", QString::number( vol ));
98 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; 98 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false;
99 qWarning("changing output vol %d", vol); 99 owarn << "changing output vol " << vol << "" << oendl;
100 } 100 }
101 ::close(fd); 101 ::close(fd);
102} 102}
103 103
104void Device::changedInVolume(int vol ) { 104void Device::changedInVolume(int vol ) {
105 int level = (vol << 8) + vol; 105 int level = (vol << 8) + vol;
106 int fd = 0; 106 int fd = 0;
107 if ((fd = open("/dev/mixer", O_RDWR))>=0) { 107 if ((fd = open("/dev/mixer", O_RDWR))>=0) {
108 if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_MIC), &level) == -1) 108 if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_MIC), &level) == -1)
109 perror("ioctl(\"MIXER_IN_WRITE\")"); 109 perror("ioctl(\"MIXER_IN_WRITE\")");
110 Config cfg("qpe"); 110 Config cfg("qpe");
111 cfg.setGroup("Volume"); 111 cfg.setGroup("Volume");
112 cfg.writeEntry("Mic", QString::number(vol )); 112 cfg.writeEntry("Mic", QString::number(vol ));
113 QCopEnvelope( "QPE/System", "micChange(bool)" ) << false; 113 QCopEnvelope( "QPE/System", "micChange(bool)" ) << false;
114 qWarning("changing input volume %d", vol); 114 owarn << "changing input volume " << vol << "" << oendl;
115 } 115 }
116 ::close(fd); 116 ::close(fd);
117} 117}
118 118
119bool Device::selectMicInput() { 119bool Device::selectMicInput() {
120 120
121 int md=0; 121 int md=0;
122 int info=MIXER_WRITE(SOUND_MIXER_MIC); 122 int info=MIXER_WRITE(SOUND_MIXER_MIC);
123 md = ::open( "/dev/mixer", O_RDWR ); 123 md = ::open( "/dev/mixer", O_RDWR );
124 if ( md == -1) 124 if ( md == -1)
125 perror("open(\"/dev/mixer\")"); 125 perror("open(\"/dev/mixer\")");
126 else { 126 else {
@@ -140,56 +140,56 @@ int Device::openDevice( int flags) {
140 int pipefd[2]; 140 int pipefd[2];
141 char message[20]; 141 char message[20];
142 if (pipe(pipefd) == -1){ 142 if (pipe(pipefd) == -1){
143 perror ("Error creating pipe"); 143 perror ("Error creating pipe");
144exit(1); 144exit(1);
145 } 145 }
146 switch (pid = fork()) { 146 switch (pid = fork()) {
147 case -1: 147 case -1:
148 perror("The fork failed!"); 148 perror("The fork failed!");
149 break; 149 break;
150 case 0: { 150 case 0: {
151 */ 151 */
152qDebug("Opening %s",dspstr); 152odebug << "Opening " << dspstr << "" << oendl;
153 if (( sd = ::open( dspstr, flags)) == -1) { 153 if (( sd = ::open( dspstr, flags)) == -1) {
154 perror("open(\"/dev/dsp\")"); 154 perror("open(\"/dev/dsp\")");
155 QString errorMsg="Could not open audio device\n /dev/dsp\n" 155 QString errorMsg="Could not open audio device\n /dev/dsp\n"
156 +(QString)strerror(errno); 156 +(QString)strerror(errno);
157 qDebug("XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg); 157 odebug << "XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg << oendl;
158 return -1; 158 return -1;
159 } 159 }
160 160
161qDebug("Opening mixer"); 161odebug << "Opening mixer" << oendl;
162 int mixerHandle=0; 162 int mixerHandle=0;
163 if (( mixerHandle = open("/dev/mixer",O_RDWR))<0) { 163 if (( mixerHandle = open("/dev/mixer",O_RDWR))<0) {
164 perror("open(\"/dev/mixer\")"); 164 perror("open(\"/dev/mixer\")");
165 QString errorMsg="Could not open audio device\n /dev/dsp\n" 165 QString errorMsg="Could not open audio device\n /dev/dsp\n"
166 +(QString)strerror(errno); 166 +(QString)strerror(errno);
167 qDebug("XXXXXXXXXXXXXXXXXXXXXX "+errorMsg); 167 odebug << "XXXXXXXXXXXXXXXXXXXXXX "+errorMsg << oendl;
168 } 168 }
169 169
170 if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){ 170 if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){
171 perror("ioctl RESET"); 171 perror("ioctl RESET");
172 } 172 }
173// sprintf(message, "%d", sd); 173// sprintf(message, "%d", sd);
174 174
175/* QFile f1("/pid"); 175/* QFile f1("/pid");
176 f1.open(IO_WriteOnly ); 176 f1.open(IO_WriteOnly );
177 f1.writeBlock(message, strlen(message)); 177 f1.writeBlock(message, strlen(message));
178 f1.close(); 178 f1.close();
179 */ 179 */
180 /* close(pipefd[0]); 180 /* close(pipefd[0]);
181 write(pipefd[1], message, sizeof(message)); 181 write(pipefd[1], message, sizeof(message));
182 close(pipefd[1]); 182 close(pipefd[1]);
183 // qDebug("%d",soundDevice->sd ); 183 // odebug << "" << soundDevice->sd << "" << oendl;
184 _exit(0); 184 _exit(0);
185 } 185 }
186 default: 186 default:
187 // pid greater than zero is parent getting the child's pid 187 // pid greater than zero is parent getting the child's pid
188 printf("Child's pid is %d\n",pid); 188 printf("Child's pid is %d\n",pid);
189 QString s; 189 QString s;
190 close(pipefd[1]); 190 close(pipefd[1]);
191 read(pipefd[0], message, sizeof(message)); 191 read(pipefd[0], message, sizeof(message));
192 s = message; 192 s = message;
193 close(pipefd[0]); 193 close(pipefd[0]);
194 194
195// while(wait(NULL)!=pid) 195// while(wait(NULL)!=pid)
@@ -197,74 +197,74 @@ qDebug("Opening mixer");
197 printf("child %ld terminated normally, return status is zero\n", (long) pid); 197 printf("child %ld terminated normally, return status is zero\n", (long) pid);
198 */ 198 */
199 // filePara.sd=(long) pid; 199 // filePara.sd=(long) pid;
200 /* QFile f2("/pid"); 200 /* QFile f2("/pid");
201 f2.open(IO_ReadOnly); 201 f2.open(IO_ReadOnly);
202 QTextStream t(&f2); 202 QTextStream t(&f2);
203 // for(int f=0; f < t.atEnd() ;f++) { 203 // for(int f=0; f < t.atEnd() ;f++) {
204 s = t.readLine(); 204 s = t.readLine();
205 // } 205 // }
206 */ 206 */
207// bool ok; 207// bool ok;
208// sd = s.toInt(&ok, 10); 208// sd = s.toInt(&ok, 10);
209// qDebug("<<<<<<<<<<<<<>>>>>>>>>>>>"+s); 209// odebug << "<<<<<<<<<<<<<>>>>>>>>>>>>"+s << oendl;
210 210
211// f2.close(); 211// f2.close();
212// } 212// }
213::close(mixerHandle ); 213::close(mixerHandle );
214// qDebug("open device %s", dspstr); 214// odebug << "open device " << dspstr << "" << oendl;
215// qDebug("success! %d",sd); 215// odebug << "success! " << sd << "" << oendl;
216 return sd; 216 return sd;
217} 217}
218 218
219bool Device::closeDevice( bool) { 219bool Device::closeDevice( bool) {
220// if(b) {//close now 220// if(b) {//close now
221// if (ioctl( sd, SNDCTL_DSP_RESET, 0) == -1) { 221// if (ioctl( sd, SNDCTL_DSP_RESET, 0) == -1) {
222// perror("ioctl(\"SNDCTL_DSP_RESET\")"); 222// perror("ioctl(\"SNDCTL_DSP_RESET\")");
223// } 223// }
224// } else { //let play 224// } else { //let play
225// if (ioctl( sd, SNDCTL_DSP_SYNC, 0) == -1) { 225// if (ioctl( sd, SNDCTL_DSP_SYNC, 0) == -1) {
226// perror("ioctl(\"SNDCTL_DSP_SYNC\")"); 226// perror("ioctl(\"SNDCTL_DSP_SYNC\")");
227// } 227// }
228// } 228// }
229 229
230 ::close( sd); //close sound device 230 ::close( sd); //close sound device
231// sdfd=0; 231// sdfd=0;
232 // sd=0; 232 // sd=0;
233// qDebug("closed dsp"); 233// odebug << "closed dsp" << oendl;
234 return true; 234 return true;
235} 235}
236 236
237bool Device::setDeviceFormat( int form) { 237bool Device::setDeviceFormat( int form) {
238 qDebug("set device res %d %d", form, sd); 238 odebug << "set device res " << form << " " << sd << "" << oendl;
239 if (ioctl( sd, SNDCTL_DSP_SETFMT, &form)==-1) { //set format 239 if (ioctl( sd, SNDCTL_DSP_SETFMT, &form)==-1) { //set format
240 perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); 240 perror("ioctl(\"SNDCTL_DSP_SETFMT\")");
241 return false; 241 return false;
242 } 242 }
243 devRes=form; 243 devRes=form;
244 return true; 244 return true;
245} 245}
246 246
247bool Device::setDeviceChannels( int ch) { 247bool Device::setDeviceChannels( int ch) {
248 qDebug("set channels %d %d", ch, sd); 248 odebug << "set channels " << ch << " " << sd << "" << oendl;
249 if (ioctl( sd, SNDCTL_DSP_CHANNELS, &ch)==-1) { 249 if (ioctl( sd, SNDCTL_DSP_CHANNELS, &ch)==-1) {
250 perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); 250 perror("ioctl(\"SNDCTL_DSP_CHANNELS\")");
251 return false; 251 return false;
252 } 252 }
253 devCh=ch; 253 devCh=ch;
254 return true; 254 return true;
255} 255}
256 256
257bool Device::setDeviceRate( int rate) { 257bool Device::setDeviceRate( int rate) {
258 qDebug("set rate %d %d", rate, sd); 258 odebug << "set rate " << rate << " " << sd << "" << oendl;
259 if (ioctl( sd, SNDCTL_DSP_SPEED, &rate) == -1) { 259 if (ioctl( sd, SNDCTL_DSP_SPEED, &rate) == -1) {
260 perror("ioctl(\"SNDCTL_DSP_SPEED\")"); 260 perror("ioctl(\"SNDCTL_DSP_SPEED\")");
261 return false; 261 return false;
262 } 262 }
263 263
264 devRate=rate; 264 devRate=rate;
265 265
266 return true; 266 return true;
267} 267}
268 268
269int Device::getRes() { 269int Device::getRes() {
270 return devRes; 270 return devRes;
@@ -309,27 +309,27 @@ int Device::getDeviceBits() {
309int Device::getDeviceChannels() { 309int Device::getDeviceChannels() {
310 int dCh=0; 310 int dCh=0;
311 if (ioctl( sd, SOUND_PCM_READ_CHANNELS, &dCh) == -1) { 311 if (ioctl( sd, SOUND_PCM_READ_CHANNELS, &dCh) == -1) {
312 perror("ioctl(\"SNDCTL_PCM_READ_CHANNELS\")"); 312 perror("ioctl(\"SNDCTL_PCM_READ_CHANNELS\")");
313 } 313 }
314 return dCh; 314 return dCh;
315} 315}
316 316
317int Device::getDeviceFragSize() { 317int Device::getDeviceFragSize() {
318 int frag_size; 318 int frag_size;
319 319
320 if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) { 320 if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) {
321 qDebug("no fragsize"); 321 odebug << "no fragsize" << oendl;
322 } else { 322 } else {
323 qDebug("driver says frag size is %d", frag_size); 323 odebug << "driver says frag size is " << frag_size << "" << oendl;
324 } 324 }
325 return frag_size; 325 return frag_size;
326} 326}
327 327
328bool Device::setFragSize(int frag) { 328bool Device::setFragSize(int frag) {
329 if (ioctl(sd, SNDCTL_DSP_SETFRAGMENT, &frag)) { 329 if (ioctl(sd, SNDCTL_DSP_SETFRAGMENT, &frag)) {
330 perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")"); 330 perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")");
331 return false; 331 return false;
332 } 332 }
333 return true; 333 return true;
334} 334}
335 335
diff --git a/noncore/multimedia/opierec/helpwindow.cpp b/noncore/multimedia/opierec/helpwindow.cpp
index 6aebaa1..7f984c3 100644
--- a/noncore/multimedia/opierec/helpwindow.cpp
+++ b/noncore/multimedia/opierec/helpwindow.cpp
@@ -1,40 +1,45 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$ 2** $Id$
3** 3**
4** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 4** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
5** 5**
6** This file is part of an example program for Qt. This example 6** This file is part of an example program for Qt. This example
7** program may be used, distributed and modified without limitation. 7** program may be used, distributed and modified without limitation.
8** 8**
9*****************************************************************************/ 9*****************************************************************************/
10 10
11#include "helpwindow.h" 11#include "helpwindow.h"
12#include <qlayout.h>
13 12
14#include <qtoolbar.h> 13/* OPIE */
14#include <opie2/odebug.h>
15#include <qpe/resource.h> 15#include <qpe/resource.h>
16using namespace Opie::Core;
16 17
18/* QT */
19#include <qlayout.h>
20#include <qtoolbar.h>
17#include <qaction.h> 21#include <qaction.h>
18#include <qmenubar.h> 22#include <qmenubar.h>
19 23
24/* STD */
20#include <ctype.h> 25#include <ctype.h>
21 26
22HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name ) 27HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name )
23 : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL() 28 : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL()
24{ 29{
25 QGridLayout *layout = new QGridLayout( this ); 30 QGridLayout *layout = new QGridLayout( this );
26 layout->setSpacing( 2); 31 layout->setSpacing( 2);
27 layout->setMargin( 2); 32 layout->setMargin( 2);
28 qDebug(_path); 33 odebug << _path << oendl;
29 browser = new QTextBrowser( this ); 34 browser = new QTextBrowser( this );
30 QStringList Strlist; 35 QStringList Strlist;
31 Strlist.append( home_); 36 Strlist.append( home_);
32 browser->mimeSourceFactory()->setFilePath( Strlist ); 37 browser->mimeSourceFactory()->setFilePath( Strlist );
33 browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 38 browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
34 39
35 connect( browser, SIGNAL( textChanged() ), this, SLOT( textChanged() ) ); 40 connect( browser, SIGNAL( textChanged() ), this, SLOT( textChanged() ) );
36 41
37 if ( !home_.isEmpty() ) 42 if ( !home_.isEmpty() )
38 browser->setSource( home_ ); 43 browser->setSource( home_ );
39 QToolBar *toolbar = new QToolBar( this ); 44 QToolBar *toolbar = new QToolBar( this );
40 45
diff --git a/noncore/multimedia/opierec/opierec.pro b/noncore/multimedia/opierec/opierec.pro
index 7b08f0e..ea1bae3 100644
--- a/noncore/multimedia/opierec/opierec.pro
+++ b/noncore/multimedia/opierec/opierec.pro
@@ -1,15 +1,13 @@
1#CONFIG = qt warn_on pdaudio 1CONFIG = qt warn_on
2CONFIG = qt warn_on opie
3#CONFIG = qt warn_on quick-app
4HEADERS = adpcm.h \ 2HEADERS = adpcm.h \
5 pixmaps.h \ 3 pixmaps.h \
6 helpwindow.h \ 4 helpwindow.h \
7 qtrec.h \ 5 qtrec.h \
8 device.h \ 6 device.h \
9 wavFile.h \ 7 wavFile.h \
10 waveform.h 8 waveform.h
11SOURCES = adpcm.c \ 9SOURCES = adpcm.c \
12 helpwindow.cpp \ 10 helpwindow.cpp \
13 main.cpp \ 11 main.cpp \
14 qtrec.cpp \ 12 qtrec.cpp \
15 device.cpp \ 13 device.cpp \
@@ -20,22 +18,22 @@ INTERFACES =
20contains(CONFIG, pdaudio) { 18contains(CONFIG, pdaudio) {
21# LIBS += -L/opt/buildroot-opie/output/staging/target/lib -lqpe -lpthread -ljpeg -lpng -lz 19# LIBS += -L/opt/buildroot-opie/output/staging/target/lib -lqpe -lpthread -ljpeg -lpng -lz
22 LIBS += -L$(QPEDIR)/lib -lqpe -lpthread -ljpeg -lpng -lz -lopiecore2 20 LIBS += -L$(QPEDIR)/lib -lqpe -lpthread -ljpeg -lpng -lz -lopiecore2
23 INCLUDEPATH += $(QPEDIR)/include 21 INCLUDEPATH += $(QPEDIR)/include
24 DEPENDPATH += $(QPEDIR)/include 22 DEPENDPATH += $(QPEDIR)/include
25 DEFINES += PDAUDIO 23 DEFINES += PDAUDIO
26 DEFINES += THREADED 24 DEFINES += THREADED
27 TARGET = qperec 25 TARGET = qperec
28 26
29# DESTDIR=$(QPEDIR)/bin 27# DESTDIR=$(QPEDIR)/bin
30} 28}
31 29
32contains(CONFIG, opie) { 30!contains(CONFIG, pdaudio) {
33 INCLUDEPATH += $(OPIEDIR)/include 31 INCLUDEPATH += $(OPIEDIR)/include
34 DEPENDPATH += $(OPIEDIR)/include 32 DEPENDPATH += $(OPIEDIR)/include
35 DESTDIR=$(OPIEDIR)/bin 33 DESTDIR=$(OPIEDIR)/bin
36 LIBS += -lqpe -lopiecore2 -lpthread 34 LIBS += -lqpe -lopiecore2 -lpthread
37 TARGET = opierec 35 TARGET = opierec
38 include ( $(OPIEDIR)/include.pro ) 36 include ( $(OPIEDIR)/include.pro )
39} 37}
40 38
41 39
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp
index 1c64ab1..2187d5a 100644
--- a/noncore/multimedia/opierec/qtrec.cpp
+++ b/noncore/multimedia/opierec/qtrec.cpp
@@ -1,68 +1,67 @@
1/**************************************************************************** 1/****************************************************************************
2 // qtrec.cpp 2 // qtrec.cpp
3 Created: Thu Jan 17 11:19:58 2002 3 Created: Thu Jan 17 11:19:58 2002
4 copyright 2002 by L.J. Potter <ljp@llornkcor.com> 4 copyright 2002 by L.J. Potter <ljp@llornkcor.com>
5****************************************************************************/ 5****************************************************************************/
6#define DEV_VERSION 6#define DEV_VERSION
7 7
8#include "pixmaps.h" 8#include "pixmaps.h"
9#include "qtrec.h" 9#include "qtrec.h"
10#include "waveform.h" 10#include "waveform.h"
11
12#include <pthread.h>
13
14extern "C" { 11extern "C" {
15#include "adpcm.h" 12#include "adpcm.h"
16} 13}
17 14
18#include <sys/soundcard.h> 15/* OPIE */
19 16#include <opie2/odebug.h>
20#include <qpe/config.h> 17#include <qpe/config.h>
21#include <qpe/qcopenvelope_qws.h> 18#include <qpe/qcopenvelope_qws.h>
22#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
23#include <qpe/resource.h> 20#include <qpe/resource.h>
24#include <qpe/storage.h> 21#include <qpe/storage.h>
22using namespace Opie::Core;
25 23
24/* QT */
26#include <qcheckbox.h> 25#include <qcheckbox.h>
27#include <qcombobox.h> 26#include <qcombobox.h>
28//#include <qdatetime.h>
29#include <qdir.h> 27#include <qdir.h>
30#include <qgroupbox.h> 28#include <qgroupbox.h>
31#include <qlabel.h> 29#include <qlabel.h>
32#include <qlayout.h> 30#include <qlayout.h>
33#include <qlistview.h> 31#include <qlistview.h>
34#include <qmessagebox.h> 32#include <qmessagebox.h>
35#include <qpopupmenu.h> 33#include <qpopupmenu.h>
36#include <qpushbutton.h> 34#include <qpushbutton.h>
37#include <qslider.h> 35#include <qslider.h>
38#include <qtabwidget.h> 36#include <qtabwidget.h>
39#include <qtimer.h> 37#include <qtimer.h>
40 38
39/* STD */
41#include <errno.h> 40#include <errno.h>
42#include <fcntl.h> 41#include <fcntl.h>
43#include <math.h> 42#include <math.h>
44#include <mntent.h> 43#include <mntent.h>
45#include <stdio.h> 44#include <stdio.h>
46#include <stdlib.h> 45#include <stdlib.h>
47#include <sys/ioctl.h> 46#include <sys/ioctl.h>
48#include <sys/soundcard.h> 47#include <sys/soundcard.h>
49#include <sys/stat.h> 48#include <sys/stat.h>
50#include <sys/time.h> 49#include <sys/time.h>
51#include <sys/types.h> 50#include <sys/types.h>
52#include <sys/vfs.h> 51#include <sys/vfs.h>
53#include <unistd.h> 52#include <unistd.h>
54#include <sys/wait.h> 53#include <sys/wait.h>
55#include <sys/signal.h> 54#include <sys/signal.h>
56 55#include <pthread.h>
57 56
58#ifdef PDAUDIO //ALSA 57#ifdef PDAUDIO //ALSA
59#include <alsa/asoundlib.h> 58#include <alsa/asoundlib.h>
60static int deviceSampleRates[8] = { 32000, 44100, 48000, 88200, 96000, 176400, 192000, -1 }; 59static int deviceSampleRates[8] = { 32000, 44100, 48000, 88200, 96000, 176400, 192000, -1 };
61static int deviceBitRates[] = { 8, 16, 24, 32, -1 }; 60static int deviceBitRates[] = { 8, 16, 24, 32, -1 };
62#else //OSS 61#else //OSS
63static int deviceSampleRates[6] = { 11025, 16000, 22050, 32000, 44100, -1 }; 62static int deviceSampleRates[6] = { 11025, 16000, 22050, 32000, 44100, -1 };
64static int deviceBitRates[] = { 8, 16, -1 }; 63static int deviceBitRates[] = { 8, 16, -1 };
65#endif 64#endif
66 65
67#if defined(QT_QWS_SL5XXX) 66#if defined(QT_QWS_SL5XXX)
68///#if defined(QT_QWS_EBX) 67///#if defined(QT_QWS_EBX)
@@ -127,55 +126,55 @@ void quickRec()
127 qDebug("samples %d, rate %d, channels %d", 126 qDebug("samples %d, rate %d, channels %d",
128 filePara.numberSamples, filePara.sampleRate, filePara.channels); 127 filePara.numberSamples, filePara.sampleRate, filePara.channels);
129 128
130 int total = 0; // Total number of bytes read in so far. 129 int total = 0; // Total number of bytes read in so far.
131 int bytesWritten, number; 130 int bytesWritten, number;
132 131
133 bytesWritten = 0; 132 bytesWritten = 0;
134 number = 0; 133 number = 0;
135 QString num; 134 QString num;
136 int level = 0; 135 int level = 0;
137 int threshold = 0; 136 int threshold = 0;
138// int bits = filePara.resolution; 137// int bits = filePara.resolution;
139// qDebug("bits %d", bits); 138// odebug << "bits " << bits << "" << oendl;
140 139
141 if( filePara.resolution == 16 ) { //AFMT_S16_LE) 140 if( filePara.resolution == 16 ) { //AFMT_S16_LE)
142// qDebug("AFMT_S16_LE size %d", filePara.SecondsToRecord); 141// odebug << "AFMT_S16_LE size " << filePara.SecondsToRecord << "" << oendl;
143// qDebug("samples to record %d", filePara.samplesToRecord); 142// odebug << "samples to record " << filePara.samplesToRecord << "" << oendl;
144// qDebug("%d", filePara.sd); 143// odebug << "" << filePara.sd << "" << oendl;
145 level = 7; 144 level = 7;
146 threshold = 0; 145 threshold = 0;
147 146
148 if( filePara.format == WAVE_FORMAT_DVI_ADPCM) { 147 if( filePara.format == WAVE_FORMAT_DVI_ADPCM) {
149// qDebug("start recording WAVE_FORMAT_DVI_ADPCM"); 148// odebug << "start recording WAVE_FORMAT_DVI_ADPCM" << oendl;
150 // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> 149 // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>>
151 char abuf[ BUFSIZE/2 ]; 150 char abuf[ BUFSIZE/2 ];
152 short sbuf[ BUFSIZE ]; 151 short sbuf[ BUFSIZE ];
153 short sbuf2[ BUFSIZE ]; 152 short sbuf2[ BUFSIZE ];
154 memset( abuf, 0, BUFSIZE/2); 153 memset( abuf, 0, BUFSIZE/2);
155 memset( sbuf, 0, BUFSIZE); 154 memset( sbuf, 0, BUFSIZE);
156 memset( sbuf2, 0, BUFSIZE); 155 memset( sbuf2, 0, BUFSIZE);
157 156
158 for(;;) { 157 for(;;) {
159 if ( stopped) { 158 if ( stopped) {
160 // qDebug("quickRec:: stopped"); 159 // odebug << "quickRec:: stopped" << oendl;
161 break; 160 break;
162 } 161 }
163 162
164// number=::read( filePara.sd, sbuf, BUFSIZE); 163// number=::read( filePara.sd, sbuf, BUFSIZE);
165 number = soundDevice ->devRead( filePara.sd, sbuf, BUFSIZE); 164 number = soundDevice ->devRead( filePara.sd, sbuf, BUFSIZE);
166 165
167 if(number <= 0) { 166 if(number <= 0) {
168 perror("recording error "); 167 perror("recording error ");
169 qDebug( "%s %d", filePara.fileName, number); 168 odebug << "" << filePara.fileName << " " << number << "" << oendl;
170 stopped = true; 169 stopped = true;
171 return; 170 return;
172 } 171 }
173 //if(stereo == 2) { 172 //if(stereo == 2) {
174// adpcm_coder( sbuf2, abuf, number/2, &encoder_state); 173// adpcm_coder( sbuf2, abuf, number/2, &encoder_state);
175 adpcm_coder( sbuf, abuf, number/2, &encoder_state); 174 adpcm_coder( sbuf, abuf, number/2, &encoder_state);
176 175
177 bytesWritten = ::write( filePara.fd , (short *)abuf, number/4); 176 bytesWritten = ::write( filePara.fd , (short *)abuf, number/4);
178 177
179 waveform->newSamples( (const short *)abuf, bytesWritten ); 178 waveform->newSamples( (const short *)abuf, bytesWritten );
180 179
181 total += bytesWritten; 180 total += bytesWritten;
@@ -183,43 +182,43 @@ void quickRec()
183 timeSlider->setValue( total); 182 timeSlider->setValue( total);
184 183
185 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2 / filePara.channels; 184 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2 / filePara.channels;
186 185
187 qApp->processEvents(); 186 qApp->processEvents();
188 if( total >= filePara.samplesToRecord) { 187 if( total >= filePara.samplesToRecord) {
189 stopped = true; 188 stopped = true;
190 break; 189 break;
191 } 190 }
192 } 191 }
193 } else { 192 } else {
194 // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>> 193 // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>>
195 qDebug("start recording WAVE_FORMAT_PCM"); 194 odebug << "start recording WAVE_FORMAT_PCM" << oendl;
196 short inbuffer[ BUFSIZE ], outbuffer[ BUFSIZE ]; 195 short inbuffer[ BUFSIZE ], outbuffer[ BUFSIZE ];
197 memset( inbuffer, 0, BUFSIZE); 196 memset( inbuffer, 0, BUFSIZE);
198 memset( outbuffer, 0, BUFSIZE); 197 memset( outbuffer, 0, BUFSIZE);
199 198
200 for(;;) { 199 for(;;) {
201 if ( stopped) { 200 if ( stopped) {
202 qDebug("quickRec:: stopped"); 201 odebug << "quickRec:: stopped" << oendl;
203 stopped = true; 202 stopped = true;
204 break; // stop if playing was set to false 203 break; // stop if playing was set to false
205 return; 204 return;
206 } 205 }
207 206
208 number = soundDevice->devRead( filePara.sd, (short *)inbuffer, BUFSIZE); 207 number = soundDevice->devRead( filePara.sd, (short *)inbuffer, BUFSIZE);
209 waveform->newSamples( inbuffer, number ); 208 waveform->newSamples( inbuffer, number );
210 209
211 if( number <= 0) { 210 if( number <= 0) {
212 perror( "recording error "); 211 perror( "recording error ");
213 qDebug( filePara.fileName); 212 odebug << filePara.fileName << oendl;
214 stopped = true; 213 stopped = true;
215 return; 214 return;
216 } 215 }
217 216
218 bytesWritten = ::write( filePara.fd , inbuffer, number); 217 bytesWritten = ::write( filePara.fd , inbuffer, number);
219 218
220 if( bytesWritten < 0) { 219 if( bytesWritten < 0) {
221 perror("File writing error "); 220 perror("File writing error ");
222 stopped = true; 221 stopped = true;
223 return; 222 return;
224 } 223 }
225 224
@@ -241,25 +240,25 @@ void quickRec()
241 } 240 }
242 } 241 }
243 } //end main loop 242 } //end main loop
244 243
245 } else { 244 } else {
246// <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8; 245// <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8;
247 unsigned char unsigned_inbuffer[ BUFSIZE ], unsigned_outbuffer[ BUFSIZE ]; 246 unsigned char unsigned_inbuffer[ BUFSIZE ], unsigned_outbuffer[ BUFSIZE ];
248 memset( unsigned_inbuffer, 0, BUFSIZE); 247 memset( unsigned_inbuffer, 0, BUFSIZE);
249 memset( unsigned_outbuffer, 0, BUFSIZE); 248 memset( unsigned_outbuffer, 0, BUFSIZE);
250 249
251 for(;;) { 250 for(;;) {
252 if ( stopped) { 251 if ( stopped) {
253 qDebug("quickRec:: stopped"); 252 odebug << "quickRec:: stopped" << oendl;
254 break; // stop if playing was set to false 253 break; // stop if playing was set to false
255 } 254 }
256 255
257 number = ::read( filePara.sd, unsigned_inbuffer, BUFSIZE); 256 number = ::read( filePara.sd, unsigned_inbuffer, BUFSIZE);
258 bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number); 257 bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number);
259 258
260 if(bytesWritten < 0) { 259 if(bytesWritten < 0) {
261 stopped = true; 260 stopped = true;
262 QMessageBox::message("Note","There was a problem\nwriting to the file"); 261 QMessageBox::message("Note","There was a problem\nwriting to the file");
263 perror("File writing error "); 262 perror("File writing error ");
264 return; 263 return;
265 } 264 }
@@ -364,25 +363,25 @@ void playIt()
364 total += bytesWritten; 363 total += bytesWritten;
365 timeSlider->setValue( total); 364 timeSlider->setValue( total);
366 365
367 filePara.numberSamples = total; 366 filePara.numberSamples = total;
368 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2; 367 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2;
369 368
370// timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds); 369// timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds);
371// timeLabel->setText( timeString + tr(" seconds")); 370// timeLabel->setText( timeString + tr(" seconds"));
372 371
373 qApp->processEvents(); 372 qApp->processEvents();
374 373
375 if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { 374 if( /*total >= filePara.numberSamples || */ bytesWritten == 0) {
376 qWarning("Jane! Stop this crazy thing!"); 375 owarn << "Jane! Stop this crazy thing!" << oendl;
377 stopped = true; 376 stopped = true;
378// playing = false; 377// playing = false;
379 break; 378 break;
380 } 379 }
381 } 380 }
382 printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total); 381 printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total);
383 fflush(stdout); 382 fflush(stdout);
384 } //end loop 383 } //end loop
385 } else { 384 } else {
386/////////////////////////////// format = AFMT_U8; 385/////////////////////////////// format = AFMT_U8;
387 unsigned char unsigned_inbuffer[ BUFSIZE ]; //, unsigned_outbuffer[BUFSIZE]; 386 unsigned char unsigned_inbuffer[ BUFSIZE ]; //, unsigned_outbuffer[BUFSIZE];
388 memset( unsigned_inbuffer, 0, BUFSIZE); 387 memset( unsigned_inbuffer, 0, BUFSIZE);
@@ -709,25 +708,25 @@ void QtRec::init() {
709 waveform->setBackgroundColor ( black ); 708 waveform->setBackgroundColor ( black );
710} 709}
711 710
712void QtRec::initIconView() { 711void QtRec::initIconView() {
713 712
714 ListView1->clear(); 713 ListView1->clear();
715 Config cfg("OpieRec"); 714 Config cfg("OpieRec");
716 cfg.setGroup("Sounds"); 715 cfg.setGroup("Sounds");
717 QString temp; 716 QString temp;
718 QPixmap image0( ( const char** ) image0_data ); 717 QPixmap image0( ( const char** ) image0_data );
719 718
720 int nFiles = cfg.readNumEntry("NumberofFiles",0); 719 int nFiles = cfg.readNumEntry("NumberofFiles",0);
721 // qDebug("init number of files %d", nFiles); 720 // odebug << "init number of files " << nFiles << "" << oendl;
722 721
723 for(int i=1;i<= nFiles;i++) { 722 for(int i=1;i<= nFiles;i++) {
724 723
725 QListViewItem * item; 724 QListViewItem * item;
726 QString fileS, mediaLocation, fileDate, filePath; 725 QString fileS, mediaLocation, fileDate, filePath;
727 726
728 temp.sprintf( "%d",i); 727 temp.sprintf( "%d",i);
729 temp = cfg.readEntry( temp,""); //reads currentFile 728 temp = cfg.readEntry( temp,""); //reads currentFile
730 filePath = cfg.readEntry( temp,""); //currentFileName 729 filePath = cfg.readEntry( temp,""); //currentFileName
731 730
732 QFileInfo info(filePath); 731 QFileInfo info(filePath);
733 fileDate = info.lastModified().toString(); 732 fileDate = info.lastModified().toString();
@@ -851,25 +850,25 @@ void QtRec::initConfig() {
851 if( autoMuteCheckBox->isChecked()) 850 if( autoMuteCheckBox->isChecked())
852 slotAutoMute(true); 851 slotAutoMute(true);
853 else 852 else
854 slotAutoMute(false); 853 slotAutoMute(false);
855 854
856 Config cofg( "qpe"); 855 Config cofg( "qpe");
857 cofg.setGroup( "Volume"); 856 cofg.setGroup( "Volume");
858 outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); 857 outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0));
859 inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); 858 inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0));
860} 859}
861 860
862void QtRec::stop() { 861void QtRec::stop() {
863 qWarning("STOP"); 862 owarn << "STOP" << oendl;
864 setRecordButton(false); 863 setRecordButton(false);
865 864
866 if( !recording) 865 if( !recording)
867 endPlaying(); 866 endPlaying();
868 else 867 else
869 endRecording(); 868 endRecording();
870 timeSlider->setValue(0); 869 timeSlider->setValue(0);
871} 870}
872 871
873void QtRec::doPlayBtn() { 872void QtRec::doPlayBtn() {
874 873
875 if(!stopped) { 874 if(!stopped) {
@@ -913,69 +912,69 @@ bool QtRec::rec() { //record
913 912
914 if( setupAudio( true)) 913 if( setupAudio( true))
915 if(setUpFile()) { 914 if(setUpFile()) {
916 int fileSize = 0; 915 int fileSize = 0;
917 Config cfg("OpieRec"); 916 Config cfg("OpieRec");
918 cfg.setGroup("Settings"); 917 cfg.setGroup("Settings");
919// qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d", 918// qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d",
920// soundDevice->getDeviceBits(), 919// soundDevice->getDeviceBits(),
921// soundDevice->getDeviceRate(), 920// soundDevice->getDeviceRate(),
922// soundDevice->getDeviceChannels()); 921// soundDevice->getDeviceChannels());
923 922
924 //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); 923 //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050);
925// qDebug("sample rate is %d", filePara.sampleRate); 924// odebug << "sample rate is " << filePara.sampleRate << "" << oendl;
926 filePara.SecondsToRecord = getCurrentSizeLimit(); 925 filePara.SecondsToRecord = getCurrentSizeLimit();
927 926
928// qDebug("size limit %d sec", filePara.SecondsToRecord); 927// odebug << "size limit " << filePara.SecondsToRecord << " sec" << oendl;
929 int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); 928 int diskSize = checkDiskSpace( (const QString &) wavFile->trackName());
930 929
931 if( filePara.SecondsToRecord == 0) { 930 if( filePara.SecondsToRecord == 0) {
932 fileSize = diskSize; 931 fileSize = diskSize;
933 } else if( filePara.format == WAVE_FORMAT_PCM) { 932 } else if( filePara.format == WAVE_FORMAT_PCM) {
934// qDebug("WAVE_FORMAT_PCM"); 933// odebug << "WAVE_FORMAT_PCM" << oendl;
935 fileSize = (filePara.SecondsToRecord ) * filePara.channels 934 fileSize = (filePara.SecondsToRecord ) * filePara.channels
936 * filePara.sampleRate * ( filePara.resolution / 8) + 1000; 935 * filePara.sampleRate * ( filePara.resolution / 8) + 1000;
937 } else { 936 } else {
938// qDebug("WAVE_FORMAT_DVI_ADPCM"); 937// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl;
939 fileSize = ((filePara.SecondsToRecord) * filePara.channels 938 fileSize = ((filePara.SecondsToRecord) * filePara.channels
940 * filePara.sampleRate * ( filePara.resolution / 8) ) / 4 + 250; 939 * filePara.sampleRate * ( filePara.resolution / 8) ) / 4 + 250;
941 } 940 }
942 941
943 filePara.samplesToRecord = fileSize; 942 filePara.samplesToRecord = fileSize;
944 qDebug("filesize should be %d, bits %d, rate %d", 943 qDebug("filesize should be %d, bits %d, rate %d",
945 filePara.samplesToRecord, filePara.resolution, filePara.sampleRate); 944 filePara.samplesToRecord, filePara.resolution, filePara.sampleRate);
946 if( paused) { 945 if( paused) {
947 paused = false; 946 paused = false;
948 } 947 }
949 // else { 948 // else {
950 qDebug("Setting timeslider %d", filePara.samplesToRecord); 949 odebug << "Setting timeslider " << filePara.samplesToRecord << "" << oendl;
951 // if(fileSize != 0) 950 // if(fileSize != 0)
952 timeSlider->setRange(0, filePara.samplesToRecord); 951 timeSlider->setRange(0, filePara.samplesToRecord);
953 // } 952 // }
954 953
955 if( diskSize < fileSize/1024) { 954 if( diskSize < fileSize/1024) {
956 QMessageBox::warning(this, 955 QMessageBox::warning(this,
957 tr("Low Disk Space"), 956 tr("Low Disk Space"),
958 tr("You are running low of\nrecording space\n" 957 tr("You are running low of\nrecording space\n"
959 "or a card isn't being recognized")); 958 "or a card isn't being recognized"));
960 stopped = true; //we need to be stopped 959 stopped = true; //we need to be stopped
961 stop(); 960 stop();
962 } else { 961 } else {
963 QString msg; 962 QString msg;
964 msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); 963 msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution);
965#ifdef DEV_VERSION 964#ifdef DEV_VERSION
966 setCaption( msg); 965 setCaption( msg);
967#endif 966#endif
968 filePara.fileName=currentFile.latin1(); 967 filePara.fileName=currentFile.latin1();
969 qDebug("Start recording thread"); 968 odebug << "Start recording thread" << oendl;
970 stopped = false; 969 stopped = false;
971 970
972#ifdef THREADED 971#ifdef THREADED
973 pthread_t thread1; 972 pthread_t thread1;
974 pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); 973 pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/);
975#endif 974#endif
976 toBeginningButton->setEnabled( false); 975 toBeginningButton->setEnabled( false);
977 toEndButton->setEnabled( false); 976 toEndButton->setEnabled( false);
978 977
979 startTimer(1000); 978 startTimer(1000);
980#ifndef THREADED 979#ifndef THREADED
981 quickRec(); 980 quickRec();
@@ -1001,31 +1000,31 @@ void QtRec::thisTab(QWidget* widg) {
1001 } 1000 }
1002 1001
1003 if( index==2) { //help page 1002 if( index==2) { //help page
1004 } 1003 }
1005 1004
1006 qApp->processEvents(); 1005 qApp->processEvents();
1007 update(); 1006 update();
1008 } 1007 }
1009} 1008}
1010 1009
1011void QtRec::getOutVol( ) { 1010void QtRec::getOutVol( ) {
1012 filePara.outVol = soundDevice->getOutVolume(); 1011 filePara.outVol = soundDevice->getOutVolume();
1013// qDebug("out vol %d", filePara.outVol); 1012// odebug << "out vol " << filePara.outVol << "" << oendl;
1014 OutputSlider->setValue( -filePara.outVol); 1013 OutputSlider->setValue( -filePara.outVol);
1015} 1014}
1016 1015
1017void QtRec::getInVol() { 1016void QtRec::getInVol() {
1018 filePara.inVol = soundDevice->getInVolume(); 1017 filePara.inVol = soundDevice->getInVolume();
1019// qDebug("in vol %d", filePara.inVol); 1018// odebug << "in vol " << filePara.inVol << "" << oendl;
1020 InputSlider->setValue( -filePara.inVol); 1019 InputSlider->setValue( -filePara.inVol);
1021} 1020}
1022 1021
1023void QtRec::changedOutVolume() { 1022void QtRec::changedOutVolume() {
1024 soundDevice->changedOutVolume( -OutputSlider->value()); 1023 soundDevice->changedOutVolume( -OutputSlider->value());
1025} 1024}
1026 1025
1027void QtRec::changedInVolume( ) { 1026void QtRec::changedInVolume( ) {
1028 soundDevice->changedInVolume( -InputSlider->value()); 1027 soundDevice->changedInVolume( -InputSlider->value());
1029} 1028}
1030 1029
1031 1030
@@ -1081,53 +1080,53 @@ bool QtRec::setupAudio( bool b) {
1081 sampleformat = SND_PCM_FORMAT_S32; 1080 sampleformat = SND_PCM_FORMAT_S32;
1082 else 1081 else
1083 sampleformat = SND_PCM_FORMAT_U8; 1082 sampleformat = SND_PCM_FORMAT_U8;
1084 1083
1085#else 1084#else
1086 if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16") 1085 if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16")
1087 sampleformat = AFMT_S16_LE; 1086 sampleformat = AFMT_S16_LE;
1088 else 1087 else
1089 sampleformat = AFMT_U8; 1088 sampleformat = AFMT_U8;
1090 1089
1091 if( !compressionCheckBox->isChecked()) { 1090 if( !compressionCheckBox->isChecked()) {
1092 filePara.format = WAVE_FORMAT_PCM; 1091 filePara.format = WAVE_FORMAT_PCM;
1093// qDebug("WAVE_FORMAT_PCM"); 1092// odebug << "WAVE_FORMAT_PCM" << oendl;
1094 } else { 1093 } else {
1095 filePara.format = WAVE_FORMAT_DVI_ADPCM; 1094 filePara.format = WAVE_FORMAT_DVI_ADPCM;
1096 sampleformat = AFMT_S16_LE; 1095 sampleformat = AFMT_S16_LE;
1097// qDebug("WAVE_FORMAT_DVI_ADPCM"); 1096// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl;
1098 } 1097 }
1099#endif 1098#endif
1100 1099
1101 stereo = filePara.channels; 1100 stereo = filePara.channels;
1102// filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100; 1101// filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100;
1103 flags= O_RDWR; 1102 flags= O_RDWR;
1104// flags= O_RDONLY; 1103// flags= O_RDONLY;
1105 Config hwcfg("OpieRec"); 1104 Config hwcfg("OpieRec");
1106 hwcfg.setGroup("Hardware"); 1105 hwcfg.setGroup("Hardware");
1107 dspString = hwcfg.readEntry( "Audio", DSPSTRIN); 1106 dspString = hwcfg.readEntry( "Audio", DSPSTRIN);
1108 mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXERIN); 1107 mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXERIN);
1109 recording = true; 1108 recording = true;
1110 } 1109 }
1111 1110
1112 // if(soundDevice) delete soundDevice; 1111 // if(soundDevice) delete soundDevice;
1113 qDebug("<<<<<<<<<<<<<<<<<<<open dsp %d %d %d", filePara.sampleRate, filePara.channels, sampleformat); 1112 odebug << "<<<<<<<<<<<<<<<<<<<open dsp " << filePara.sampleRate << " " << filePara.channels << " " << sampleformat << "" << oendl;
1114 qWarning("change waveform settings"); 1113 owarn << "change waveform settings" << oendl;
1115 waveform->changeSettings( filePara.sampleRate, filePara.channels ); 1114 waveform->changeSettings( filePara.sampleRate, filePara.channels );
1116 1115
1117 soundDevice = new Device( this, dspString, mixerString, b); 1116 soundDevice = new Device( this, dspString, mixerString, b);
1118// soundDevice->openDsp(); 1117// soundDevice->openDsp();
1119 soundDevice->reset(); 1118 soundDevice->reset();
1120 1119
1121 qDebug("device has been made %d", soundDevice->sd); 1120 odebug << "device has been made " << soundDevice->sd << "" << oendl;
1122 1121
1123 ////////////////// <<<<<<<<<<<<>>>>>>>>>>>> 1122 ////////////////// <<<<<<<<<<<<>>>>>>>>>>>>
1124 soundDevice->setDeviceFormat( sampleformat); 1123 soundDevice->setDeviceFormat( sampleformat);
1125 soundDevice->setDeviceChannels( filePara.channels); 1124 soundDevice->setDeviceChannels( filePara.channels);
1126 soundDevice->setDeviceRate( filePara.sampleRate); 1125 soundDevice->setDeviceRate( filePara.sampleRate);
1127 soundDevice->getDeviceFragSize(); 1126 soundDevice->getDeviceFragSize();
1128#ifdef QT_QWS_EBX 1127#ifdef QT_QWS_EBX
1129 int frag = FRAGSIZE; 1128 int frag = FRAGSIZE;
1130 soundDevice->setFragSize( frag); 1129 soundDevice->setFragSize( frag);
1131 soundDevice->getDeviceFragSize(); 1130 soundDevice->getDeviceFragSize();
1132#endif 1131#endif
1133 ///////////////// 1132 /////////////////
@@ -1140,25 +1139,25 @@ bool QtRec::setupAudio( bool b) {
1140 update(); 1139 update();
1141 setCaption( tr( "OpieRecord " )+ QString::number(VERSION) ); 1140 setCaption( tr( "OpieRecord " )+ QString::number(VERSION) );
1142 return false; 1141 return false;
1143 } 1142 }
1144 if(autoMute) 1143 if(autoMute)
1145 doMute(false); 1144 doMute(false);
1146 1145
1147 return true; 1146 return true;
1148} 1147}
1149 1148
1150 1149
1151bool QtRec::setUpFile() { //setup file for recording 1150bool QtRec::setUpFile() { //setup file for recording
1152// qDebug("Setting up wavfile"); 1151// odebug << "Setting up wavfile" << oendl;
1153// if(wavFile) delete wavFile; 1152// if(wavFile) delete wavFile;
1154 wavFile = new WavFile( this, (const QString &)"", 1153 wavFile = new WavFile( this, (const QString &)"",
1155 true, 1154 true,
1156 filePara.sampleRate, 1155 filePara.sampleRate,
1157 filePara.channels, 1156 filePara.channels,
1158 filePara.resolution, 1157 filePara.resolution,
1159 filePara.format); 1158 filePara.format);
1160 1159
1161 filePara.fd = wavFile->wavHandle(); 1160 filePara.fd = wavFile->wavHandle();
1162 if(filePara.fd == -1) { 1161 if(filePara.fd == -1) {
1163 return false; 1162 return false;
1164 } else { 1163 } else {
@@ -1173,25 +1172,25 @@ bool QtRec::doPlay() {
1173 if( !paused) { 1172 if( !paused) {
1174 total = 0; 1173 total = 0;
1175 filePara.numberOfRecordedSeconds = 0; 1174 filePara.numberOfRecordedSeconds = 0;
1176 } else { 1175 } else {
1177 paused = false; 1176 paused = false;
1178 secCount = (int)filePara.numberOfRecordedSeconds; 1177 secCount = (int)filePara.numberOfRecordedSeconds;
1179 } 1178 }
1180 playing = true; 1179 playing = true;
1181 stopped = false; 1180 stopped = false;
1182 recording = false; 1181 recording = false;
1183 1182
1184 QString num; 1183 QString num;
1185 qDebug( "Play number of samples %d", filePara.numberSamples); 1184 odebug << "Play number of samples " << filePara.numberSamples << "" << oendl;
1186 1185
1187// timeSlider->setRange( 0, filePara.numberSamples); 1186// timeSlider->setRange( 0, filePara.numberSamples);
1188 1187
1189 timeString.sprintf("%f", filePara.numberOfRecordedSeconds); 1188 timeString.sprintf("%f", filePara.numberOfRecordedSeconds);
1190 timeLabel->setText( timeString+ tr(" seconds")); 1189 timeLabel->setText( timeString+ tr(" seconds"));
1191 1190
1192 QString msg; 1191 QString msg;
1193 msg.sprintf("%d, %d, %d", 1192 msg.sprintf("%d, %d, %d",
1194 filePara.sampleRate, 1193 filePara.sampleRate,
1195 filePara.channels, 1194 filePara.channels,
1196 filePara.resolution); 1195 filePara.resolution);
1197#ifdef DEV_VERSION 1196#ifdef DEV_VERSION
@@ -1225,45 +1224,45 @@ void QtRec::changebitrateCombo(int i) {
1225 filePara.resolution = bits; 1224 filePara.resolution = bits;
1226 cfg.write(); 1225 cfg.write();
1227} 1226}
1228 1227
1229void QtRec::changesamplerateCombo(int i) { 1228void QtRec::changesamplerateCombo(int i) {
1230 Config cfg("OpieRec"); 1229 Config cfg("OpieRec");
1231 cfg.setGroup("Settings"); 1230 cfg.setGroup("Settings");
1232 int rate=0; 1231 int rate=0;
1233 bool ok; 1232 bool ok;
1234 rate = sampleRateComboBox->text(i).toInt(&ok, 10); 1233 rate = sampleRateComboBox->text(i).toInt(&ok, 10);
1235 cfg.writeEntry( "samplerate",rate); 1234 cfg.writeEntry( "samplerate",rate);
1236 filePara.sampleRate=rate; 1235 filePara.sampleRate=rate;
1237 qDebug( "Change sample rate %d", rate); 1236 odebug << "Change sample rate " << rate << "" << oendl;
1238 cfg.write(); 1237 cfg.write();
1239} 1238}
1240 1239
1241 1240
1242void QtRec::changeDirCombo(int index) { 1241void QtRec::changeDirCombo(int index) {
1243 Config cfg("OpieRec"); 1242 Config cfg("OpieRec");
1244 cfg.setGroup("Settings"); 1243 cfg.setGroup("Settings");
1245 QString sName = directoryComboBox->text(index); 1244 QString sName = directoryComboBox->text(index);
1246 1245
1247 StorageInfo storageInfo; 1246 StorageInfo storageInfo;
1248 const QList<FileSystem> &fs = storageInfo.fileSystems(); 1247 const QList<FileSystem> &fs = storageInfo.fileSystems();
1249 QListIterator<FileSystem> it ( fs ); 1248 QListIterator<FileSystem> it ( fs );
1250 QString storage; 1249 QString storage;
1251 for( ; it.current(); ++it ){ 1250 for( ; it.current(); ++it ){
1252 if( sName == (*it)->name()+" "+ (*it)->path() || 1251 if( sName == (*it)->name()+" "+ (*it)->path() ||
1253 (*it)->name() == sName ) { 1252 (*it)->name() == sName ) {
1254 const QString path = (*it)->path(); 1253 const QString path = (*it)->path();
1255 recDir = path; 1254 recDir = path;
1256 cfg.writeEntry("directory", recDir); 1255 cfg.writeEntry("directory", recDir);
1257 qDebug("new rec dir "+recDir); 1256 odebug << "new rec dir "+recDir << oendl;
1258 } 1257 }
1259 } 1258 }
1260 cfg.write(); 1259 cfg.write();
1261} 1260}
1262 1261
1263 1262
1264void QtRec::changeSizeLimitCombo(int) { 1263void QtRec::changeSizeLimitCombo(int) {
1265 Config cfg("OpieRec"); 1264 Config cfg("OpieRec");
1266 cfg.setGroup("Settings"); 1265 cfg.setGroup("Settings");
1267 cfg.writeEntry("sizeLimit", getCurrentSizeLimit() ); 1266 cfg.writeEntry("sizeLimit", getCurrentSizeLimit() );
1268 cfg.write(); 1267 cfg.write();
1269} 1268}
@@ -1365,25 +1364,25 @@ void QtRec::keyPressEvent( QKeyEvent *e) {
1365 break; 1364 break;
1366 case Key_Space: 1365 case Key_Space:
1367 break; 1366 break;
1368 case Key_Delete: 1367 case Key_Delete:
1369 break; 1368 break;
1370 case Key_Up: 1369 case Key_Up:
1371 // stop(); 1370 // stop();
1372 break; 1371 break;
1373 case Key_Down: 1372 case Key_Down:
1374 // newSound(); 1373 // newSound();
1375 break; 1374 break;
1376 case Key_Left: { 1375 case Key_Left: {
1377 qDebug("rewinding"); 1376 odebug << "rewinding" << oendl;
1378 if( !e->isAutoRepeat()) 1377 if( !e->isAutoRepeat())
1379 rewindPressed(); 1378 rewindPressed();
1380 } 1379 }
1381 break; 1380 break;
1382 case Key_Right: { 1381 case Key_Right: {
1383 if( !e->isAutoRepeat()) 1382 if( !e->isAutoRepeat())
1384 FastforwardPressed(); 1383 FastforwardPressed();
1385 } 1384 }
1386 break; 1385 break;
1387 } 1386 }
1388} 1387}
1389 1388
@@ -1419,37 +1418,37 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) {
1419 break; 1418 break;
1420 case Key_Space: 1419 case Key_Space:
1421 if(stopped && !recording) 1420 if(stopped && !recording)
1422 newSound(); 1421 newSound();
1423 else 1422 else
1424 stop(); 1423 stop();
1425 break; 1424 break;
1426 case Key_Delete: 1425 case Key_Delete:
1427 deleteSound(); 1426 deleteSound();
1428 break; 1427 break;
1429 case Key_Up: 1428 case Key_Up:
1430 // stop(); 1429 // stop();
1431 qDebug("Up"); 1430 odebug << "Up" << oendl;
1432 break; 1431 break;
1433 case Key_Down: 1432 case Key_Down:
1434 // start(); 1433 // start();
1435 // qDebug("Down"); 1434 // odebug << "Down" << oendl;
1436 // newSound(); 1435 // newSound();
1437 break; 1436 break;
1438 case Key_Left: 1437 case Key_Left:
1439 qDebug("Left"); 1438 odebug << "Left" << oendl;
1440 rewindReleased(); 1439 rewindReleased();
1441 break; 1440 break;
1442 case Key_Right: 1441 case Key_Right:
1443 qDebug("Right"); 1442 odebug << "Right" << oendl;
1444 FastforwardReleased(); 1443 FastforwardReleased();
1445 break; 1444 break;
1446 } 1445 }
1447} 1446}
1448 1447
1449void QtRec::endRecording() { 1448void QtRec::endRecording() {
1450 monitoring = false; 1449 monitoring = false;
1451 recording = false; 1450 recording = false;
1452 stopped = true; 1451 stopped = true;
1453 waveform->reset(); 1452 waveform->reset();
1454 setRecordButton( false); 1453 setRecordButton( false);
1455 1454
@@ -1466,139 +1465,139 @@ void QtRec::endRecording() {
1466 if( wavFile->track.isOpen()) { 1465 if( wavFile->track.isOpen()) {
1467 wavFile->adjustHeaders( filePara.fd, filePara.numberSamples); 1466 wavFile->adjustHeaders( filePara.fd, filePara.numberSamples);
1468 // soundDevice->sd=-1; 1467 // soundDevice->sd=-1;
1469 filePara.numberSamples = 0; 1468 filePara.numberSamples = 0;
1470 // filePara.sd=-1; 1469 // filePara.sd=-1;
1471 wavFile->closeFile(); 1470 wavFile->closeFile();
1472 filePara.fd=0; 1471 filePara.fd=0;
1473 1472
1474 if( wavFile->isTempFile()) { 1473 if( wavFile->isTempFile()) {
1475// move tmp file to regular file 1474// move tmp file to regular file
1476 QString cmd; 1475 QString cmd;
1477 cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); 1476 cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName);
1478// qDebug("moving tmp file to "+currentFileName); 1477// odebug << "moving tmp file to "+currentFileName << oendl;
1479 system( cmd.latin1()); 1478 system( cmd.latin1());
1480 } 1479 }
1481 1480
1482 qDebug("Just moved " + wavFile->currentFileName); 1481 odebug << "Just moved " + wavFile->currentFileName << oendl;
1483 Config cfg("OpieRec"); 1482 Config cfg("OpieRec");
1484 cfg.setGroup("Sounds"); 1483 cfg.setGroup("Sounds");
1485 1484
1486 int nFiles = cfg.readNumEntry( "NumberofFiles",0); 1485 int nFiles = cfg.readNumEntry( "NumberofFiles",0);
1487 1486
1488 currentFile = QFileInfo( wavFile->currentFileName).fileName(); 1487 currentFile = QFileInfo( wavFile->currentFileName).fileName();
1489 currentFile = currentFile.left( currentFile.length() - 4); 1488 currentFile = currentFile.left( currentFile.length() - 4);
1490 1489
1491 cfg.writeEntry( "NumberofFiles", nFiles + 1); 1490 cfg.writeEntry( "NumberofFiles", nFiles + 1);
1492 cfg.writeEntry( QString::number( nFiles + 1), currentFile); 1491 cfg.writeEntry( QString::number( nFiles + 1), currentFile);
1493 cfg.writeEntry( currentFile, wavFile->currentFileName); 1492 cfg.writeEntry( currentFile, wavFile->currentFileName);
1494 1493
1495 QString time; 1494 QString time;
1496 time.sprintf("%.2f", filePara.numberOfRecordedSeconds); 1495 time.sprintf("%.2f", filePara.numberOfRecordedSeconds);
1497 cfg.writeEntry( wavFile->currentFileName, time ); 1496 cfg.writeEntry( wavFile->currentFileName, time );
1498// qDebug("writing config numberOfRecordedSeconds "+time); 1497// odebug << "writing config numberOfRecordedSeconds "+time << oendl;
1499 1498
1500 cfg.write(); 1499 cfg.write();
1501 qDebug("finished recording"); 1500 odebug << "finished recording" << oendl;
1502 timeLabel->setText(""); 1501 timeLabel->setText("");
1503 } 1502 }
1504 1503
1505 if(soundDevice) delete soundDevice; 1504 if(soundDevice) delete soundDevice;
1506 1505
1507 timeSlider->setValue(0); 1506 timeSlider->setValue(0);
1508 initIconView(); 1507 initIconView();
1509 selectItemByName( currentFile); 1508 selectItemByName( currentFile);
1510} 1509}
1511 1510
1512void QtRec::endPlaying() { 1511void QtRec::endPlaying() {
1513 monitoring = false; 1512 monitoring = false;
1514 recording = false; 1513 recording = false;
1515 playing = false; 1514 playing = false;
1516 stopped = true; 1515 stopped = true;
1517 waveform->reset(); 1516 waveform->reset();
1518// errorStop(); 1517// errorStop();
1519// qDebug("end playing"); 1518// odebug << "end playing" << oendl;
1520 setRecordButton( false); 1519 setRecordButton( false);
1521 1520
1522 toBeginningButton->setEnabled( true); 1521 toBeginningButton->setEnabled( true);
1523 toEndButton->setEnabled( true); 1522 toEndButton->setEnabled( true);
1524 1523
1525 if(autoMute) 1524 if(autoMute)
1526 doMute( true); 1525 doMute( true);
1527 1526
1528 soundDevice->closeDevice( false); 1527 soundDevice->closeDevice( false);
1529 soundDevice->sd = -1; 1528 soundDevice->sd = -1;
1530 // if(soundDevice) delete soundDevice; 1529 // if(soundDevice) delete soundDevice;
1531// qDebug("file and sound device closed"); 1530// odebug << "file and sound device closed" << oendl;
1532 timeLabel->setText(""); 1531 timeLabel->setText("");
1533 total = 0; 1532 total = 0;
1534 filePara.numberSamples = 0; 1533 filePara.numberSamples = 0;
1535 filePara.sd = -1; 1534 filePara.sd = -1;
1536// wavFile->closeFile(); 1535// wavFile->closeFile();
1537 filePara.fd = 0; 1536 filePara.fd = 0;
1538// if(wavFile) delete wavFile; //this crashes 1537// if(wavFile) delete wavFile; //this crashes
1539 1538
1540// qDebug("track closed"); 1539// odebug << "track closed" << oendl;
1541 killTimers(); 1540 killTimers();
1542 qWarning("reset slider"); 1541 owarn << "reset slider" << oendl;
1543 timeSlider->setValue(0); 1542 timeSlider->setValue(0);
1544 1543
1545 if(soundDevice) delete soundDevice; 1544 if(soundDevice) delete soundDevice;
1546 1545
1547} 1546}
1548 1547
1549bool QtRec::openPlayFile() { 1548bool QtRec::openPlayFile() {
1550 1549
1551 qApp->processEvents(); 1550 qApp->processEvents();
1552 if( currentFile.isEmpty()) { 1551 if( currentFile.isEmpty()) {
1553 QMessageBox::message(tr("Opierec"),tr("Please select file to play")); 1552 QMessageBox::message(tr("Opierec"),tr("Please select file to play"));
1554 endPlaying(); 1553 endPlaying();
1555 return false; 1554 return false;
1556 } 1555 }
1557 QString currentFileName; 1556 QString currentFileName;
1558 Config cfg("OpieRec"); 1557 Config cfg("OpieRec");
1559 cfg.setGroup("Sounds"); 1558 cfg.setGroup("Sounds");
1560 int nFiles = cfg.readNumEntry( "NumberofFiles", 0); 1559 int nFiles = cfg.readNumEntry( "NumberofFiles", 0);
1561 for(int i=0;i<nFiles+1;i++) { //look for file 1560 for(int i=0;i<nFiles+1;i++) { //look for file
1562 if( cfg.readEntry( QString::number(i),"").find( currentFile,0,true) != -1) { 1561 if( cfg.readEntry( QString::number(i),"").find( currentFile,0,true) != -1) {
1563 currentFileName = cfg.readEntry( currentFile, "" ); 1562 currentFileName = cfg.readEntry( currentFile, "" );
1564 qDebug("opening for play: " + currentFileName); 1563 odebug << "opening for play: " + currentFileName << oendl;
1565 } 1564 }
1566 } 1565 }
1567 wavFile = new WavFile(this, 1566 wavFile = new WavFile(this,
1568 currentFileName, 1567 currentFileName,
1569 false); 1568 false);
1570 filePara.fd = wavFile->wavHandle(); 1569 filePara.fd = wavFile->wavHandle();
1571 if(filePara.fd == -1) { 1570 if(filePara.fd == -1) {
1572 // if(!track.open(IO_ReadOnly)) { 1571 // if(!track.open(IO_ReadOnly)) {
1573 QString errorMsg = (QString)strerror(errno); 1572 QString errorMsg = (QString)strerror(errno);
1574 monitoring = false; 1573 monitoring = false;
1575 setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); 1574 setCaption( tr( "OpieRecord " ) + QString::number(VERSION) );
1576 QMessageBox::message(tr("Note"), tr("Could not open audio file.\n") 1575 QMessageBox::message(tr("Note"), tr("Could not open audio file.\n")
1577 + errorMsg + "\n" + currentFile); 1576 + errorMsg + "\n" + currentFile);
1578 return false; 1577 return false;
1579 } else { 1578 } else {
1580 1579
1581 filePara.numberSamples = wavFile->getNumberSamples(); 1580 filePara.numberSamples = wavFile->getNumberSamples();
1582 filePara.format = wavFile->getFormat(); 1581 filePara.format = wavFile->getFormat();
1583 filePara.sampleRate = wavFile->getSampleRate(); 1582 filePara.sampleRate = wavFile->getSampleRate();
1584 filePara.resolution = wavFile->getResolution(); 1583 filePara.resolution = wavFile->getResolution();
1585 filePara.channels = wavFile->getChannels(); 1584 filePara.channels = wavFile->getChannels();
1586 timeSlider->setPageStep(1); 1585 timeSlider->setPageStep(1);
1587 monitoring = true; 1586 monitoring = true;
1588 1587
1589 qDebug("file %d, samples %d %d", filePara.fd, filePara.numberSamples, filePara.sampleRate); 1588 odebug << "file " << filePara.fd << ", samples " << filePara.numberSamples << " " << filePara.sampleRate << "" << oendl;
1590 int sec = (int) (( filePara.numberSamples / filePara.sampleRate) / filePara.channels) / ( filePara.channels*( filePara.resolution/8)); 1589 int sec = (int) (( filePara.numberSamples / filePara.sampleRate) / filePara.channels) / ( filePara.channels*( filePara.resolution/8));
1591 1590
1592 qWarning("seconds %d", sec); 1591 owarn << "seconds " << sec << "" << oendl;
1593 1592
1594 timeSlider->setRange(0, filePara.numberSamples ); 1593 timeSlider->setRange(0, filePara.numberSamples );
1595 } 1594 }
1596 1595
1597 return true; 1596 return true;
1598} 1597}
1599 1598
1600void QtRec::listPressed( int mouse, QListViewItem *item, const QPoint &, int ) { 1599void QtRec::listPressed( int mouse, QListViewItem *item, const QPoint &, int ) {
1601 if(item == NULL ) 1600 if(item == NULL )
1602 return; 1601 return;
1603 switch (mouse) { 1602 switch (mouse) {
1604 case 1: { 1603 case 1: {
@@ -1681,37 +1680,37 @@ void QtRec::doRename() {
1681 1680
1682 renameBox->selectAll(); 1681 renameBox->selectAll();
1683 renameBox->installEventFilter( this ); 1682 renameBox->installEventFilter( this );
1684 ListView1->addChild( renameBox, r.x(), r.y() ); 1683 ListView1->addChild( renameBox, r.x(), r.y() );
1685 renameBox->resize( r.size() ); 1684 renameBox->resize( r.size() );
1686 ListView1->viewport()->setFocusProxy( renameBox ); 1685 ListView1->viewport()->setFocusProxy( renameBox );
1687 renameBox->setFocus(); 1686 renameBox->setFocus();
1688 renameBox->show(); 1687 renameBox->show();
1689 1688
1690} 1689}
1691 1690
1692void QtRec::okRename() { 1691void QtRec::okRename() {
1693 qDebug(renameBox->text()); 1692 odebug << renameBox->text() << oendl;
1694 QString filename = renameBox->text(); 1693 QString filename = renameBox->text();
1695 cancelRename(); 1694 cancelRename();
1696 1695
1697 if( ListView1->currentItem() == NULL) 1696 if( ListView1->currentItem() == NULL)
1698 return; 1697 return;
1699 1698
1700 Config cfg("OpieRec"); 1699 Config cfg("OpieRec");
1701 cfg.setGroup("Sounds"); 1700 cfg.setGroup("Sounds");
1702 1701
1703 QString file = ListView1->currentItem()->text(0); 1702 QString file = ListView1->currentItem()->text(0);
1704 1703
1705 qDebug("filename is " + filename); 1704 odebug << "filename is " + filename << oendl;
1706 1705
1707 int nFiles = cfg.readNumEntry("NumberofFiles",0); 1706 int nFiles = cfg.readNumEntry("NumberofFiles",0);
1708 1707
1709 for(int i=0;i<nFiles+1;i++) { //look for file 1708 for(int i=0;i<nFiles+1;i++) { //look for file
1710 if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) { 1709 if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) {
1711 1710
1712 QString filePath = cfg.readEntry(file,""); 1711 QString filePath = cfg.readEntry(file,"");
1713 1712
1714 cfg.writeEntry( QString::number(i), filename ); 1713 cfg.writeEntry( QString::number(i), filename );
1715 cfg.writeEntry( filename, filePath ); 1714 cfg.writeEntry( filename, filePath );
1716 cfg.removeEntry( file); 1715 cfg.removeEntry( file);
1717 cfg.write(); 1716 cfg.write();
@@ -1764,25 +1763,25 @@ void QtRec::timerBreak() {
1764 endPlaying(); 1763 endPlaying();
1765} 1764}
1766 1765
1767void QtRec::doVolMuting(bool b) { 1766void QtRec::doVolMuting(bool b) {
1768 Config cfg( "qpe" ); 1767 Config cfg( "qpe" );
1769 cfg. setGroup( "Volume" ); 1768 cfg. setGroup( "Volume" );
1770 cfg.writeEntry( "Mute",b); 1769 cfg.writeEntry( "Mute",b);
1771 cfg.write(); 1770 cfg.write();
1772 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << b; 1771 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << b;
1773} 1772}
1774 1773
1775void QtRec::doMicMuting(bool b) { 1774void QtRec::doMicMuting(bool b) {
1776 // qDebug("mic mute"); 1775 // odebug << "mic mute" << oendl;
1777 Config cfg( "qpe" ); 1776 Config cfg( "qpe" );
1778 cfg. setGroup( "Volume" ); 1777 cfg. setGroup( "Volume" );
1779 cfg.writeEntry( "MicMute",b); 1778 cfg.writeEntry( "MicMute",b);
1780 cfg.write(); 1779 cfg.write();
1781 QCopEnvelope( "QPE/System", "micChange(bool)" ) << b; 1780 QCopEnvelope( "QPE/System", "micChange(bool)" ) << b;
1782} 1781}
1783 1782
1784void QtRec::compressionSelected(bool b) { 1783void QtRec::compressionSelected(bool b) {
1785 Config cfg("OpieRec"); 1784 Config cfg("OpieRec");
1786 cfg.setGroup("Settings"); 1785 cfg.setGroup("Settings");
1787 cfg.writeEntry("wavCompression", b); 1786 cfg.writeEntry("wavCompression", b);
1788 cfg.writeEntry("bitrate", 16); 1787 cfg.writeEntry("bitrate", 16);
@@ -1820,90 +1819,90 @@ long QtRec::checkDiskSpace(const QString &path) {
1820 1819
1821// short f_fstyp; /* File system type */ 1820// short f_fstyp; /* File system type */
1822// long f_bsize; /* Block size */ 1821// long f_bsize; /* Block size */
1823// long f_frsize; /* Fragment size */ 1822// long f_frsize; /* Fragment size */
1824// long f_blocks; /* Total number of blocks*/ 1823// long f_blocks; /* Total number of blocks*/
1825// long f_bfree; /* Count of free blocks */ 1824// long f_bfree; /* Count of free blocks */
1826// long f_files; /* Total number of file nodes */ 1825// long f_files; /* Total number of file nodes */
1827// long f_ffree; /* Count of free file nodes */ 1826// long f_ffree; /* Count of free file nodes */
1828// char f_fname[6]; /* Volumename */ 1827// char f_fname[6]; /* Volumename */
1829// char f_fpack[6]; /* Pack name */ 1828// char f_fpack[6]; /* Pack name */
1830 1829
1831void QtRec::receive( const QCString &msg, const QByteArray & ) { 1830void QtRec::receive( const QCString &msg, const QByteArray & ) {
1832 qDebug("Voicerecord received message "+msg); 1831 odebug << "Voicerecord received message "+msg << oendl;
1833 1832
1834} 1833}
1835 1834
1836 1835
1837///////////////////////////// timerEvent 1836///////////////////////////// timerEvent
1838void QtRec::timerEvent( QTimerEvent * ) { 1837void QtRec::timerEvent( QTimerEvent * ) {
1839 1838
1840// if(!recording) 1839// if(!recording)
1841// timeSlider->setValue( secCount); 1840// timeSlider->setValue( secCount);
1842// else 1841// else
1843// timeSlider->setValue( filePara.numberOfRecordedSeconds); 1842// timeSlider->setValue( filePara.numberOfRecordedSeconds);
1844 1843
1845 if( stopped && playing) { 1844 if( stopped && playing) {
1846 stop(); 1845 stop();
1847 } 1846 }
1848 1847
1849 if( stopped && recording ){ 1848 if( stopped && recording ){
1850 stop(); 1849 stop();
1851 } 1850 }
1852 1851
1853 if( recording && filePara.SecondsToRecord < secCount && filePara.SecondsToRecord != 0) { 1852 if( recording && filePara.SecondsToRecord < secCount && filePara.SecondsToRecord != 0) {
1854 stop(); 1853 stop();
1855 } 1854 }
1856 1855
1857 qDebug( "%d", secCount ); 1856 odebug << "" << secCount << "" << oendl;
1858 QString timeString; 1857 QString timeString;
1859#ifdef DEV_VERSION 1858#ifdef DEV_VERSION
1860 QString msg; 1859 QString msg;
1861 msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); 1860 msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution);
1862 setCaption( msg +" :: "+QString::number(secCount)); 1861 setCaption( msg +" :: "+QString::number(secCount));
1863#endif 1862#endif
1864 1863
1865 timeString.sprintf("%d", secCount); 1864 timeString.sprintf("%d", secCount);
1866 timeLabel->setText( timeString + " seconds"); 1865 timeLabel->setText( timeString + " seconds");
1867 1866
1868 secCount++; 1867 secCount++;
1869} 1868}
1870 1869
1871void QtRec::changeTimeSlider(int index) { 1870void QtRec::changeTimeSlider(int index) {
1872 if( ListView1->currentItem() == 0 || !wavFile->track.isOpen()) return; 1871 if( ListView1->currentItem() == 0 || !wavFile->track.isOpen()) return;
1873 // qDebug("Slider moved to %d",index); 1872 // odebug << "Slider moved to " << index << "" << oendl;
1874 paused = true; 1873 paused = true;
1875 stopped = true; 1874 stopped = true;
1876 1875
1877 sliderPos=index; 1876 sliderPos=index;
1878 1877
1879 QString timeString; 1878 QString timeString;
1880 filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2; 1879 filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2;
1881 timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); 1880 timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds);
1882 secCount = (int)filePara.numberOfRecordedSeconds; 1881 secCount = (int)filePara.numberOfRecordedSeconds;
1883 timeLabel->setText( timeString + tr(" seconds")); 1882 timeLabel->setText( timeString + tr(" seconds"));
1884} 1883}
1885 1884
1886void QtRec::timeSliderPressed() { 1885void QtRec::timeSliderPressed() {
1887 if( ListView1->currentItem() == 0) return; 1886 if( ListView1->currentItem() == 0) return;
1888 // qDebug("slider pressed"); 1887 // odebug << "slider pressed" << oendl;
1889 paused = true; 1888 paused = true;
1890 stopped = true; 1889 stopped = true;
1891} 1890}
1892 1891
1893void QtRec::timeSliderReleased() { 1892void QtRec::timeSliderReleased() {
1894 if( ListView1->currentItem() == 0) return; 1893 if( ListView1->currentItem() == 0) return;
1895 sliderPos = timeSlider->value(); 1894 sliderPos = timeSlider->value();
1896 1895
1897 // qDebug("slider released %d", sliderPos); 1896 // odebug << "slider released " << sliderPos << "" << oendl;
1898 stopped = false; 1897 stopped = false;
1899 int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); 1898 int newPos = lseek( filePara.fd, sliderPos, SEEK_SET);
1900 total = newPos*4; 1899 total = newPos*4;
1901 filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2; 1900 filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2;
1902 1901
1903 doPlay(); 1902 doPlay();
1904} 1903}
1905 1904
1906void QtRec::rewindPressed() { 1905void QtRec::rewindPressed() {
1907 if( ListView1->currentItem() == 0) return; 1906 if( ListView1->currentItem() == 0) return;
1908 if( !wavFile->track.isOpen()) { 1907 if( !wavFile->track.isOpen()) {
1909 if( !openPlayFile() ) 1908 if( !openPlayFile() )
@@ -1915,39 +1914,39 @@ void QtRec::rewindPressed() {
1915 killTimers(); 1914 killTimers();
1916 paused = true; 1915 paused = true;
1917 stopped = true; 1916 stopped = true;
1918 rewindTimer->start( 50, false); 1917 rewindTimer->start( 50, false);
1919 } 1918 }
1920} 1919}
1921 1920
1922void QtRec::rewindTimerTimeout() { 1921void QtRec::rewindTimerTimeout() {
1923 int sliderValue = timeSlider->value(); 1922 int sliderValue = timeSlider->value();
1924 sliderValue = sliderValue - ( filePara.numberSamples / 100); 1923 sliderValue = sliderValue - ( filePara.numberSamples / 100);
1925 // if(toBeginningButton->isDown()) 1924 // if(toBeginningButton->isDown())
1926 timeSlider->setValue( sliderValue ) ; 1925 timeSlider->setValue( sliderValue ) ;
1927 // qDebug("%d", sliderValue); 1926 // odebug << "" << sliderValue << "" << oendl;
1928 QString timeString; 1927 QString timeString;
1929 filePara.numberOfRecordedSeconds = (float)sliderValue / (float)filePara.sampleRate * (float)2; 1928 filePara.numberOfRecordedSeconds = (float)sliderValue / (float)filePara.sampleRate * (float)2;
1930 timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); 1929 timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds);
1931 timeLabel->setText( timeString+ tr(" seconds")); 1930 timeLabel->setText( timeString+ tr(" seconds"));
1932} 1931}
1933 1932
1934void QtRec::rewindReleased() { 1933void QtRec::rewindReleased() {
1935 rewindTimer->stop(); 1934 rewindTimer->stop();
1936 if( wavFile->track.isOpen()) { 1935 if( wavFile->track.isOpen()) {
1937 sliderPos=timeSlider->value(); 1936 sliderPos=timeSlider->value();
1938 stopped = false; 1937 stopped = false;
1939 int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); 1938 int newPos = lseek( filePara.fd, sliderPos, SEEK_SET);
1940 total = newPos * 4; 1939 total = newPos * 4;
1941 // qDebug("rewind released %d", total); 1940 // odebug << "rewind released " << total << "" << oendl;
1942 startTimer( 1000); 1941 startTimer( 1000);
1943 doPlay(); 1942 doPlay();
1944 } 1943 }
1945} 1944}
1946 1945
1947void QtRec::FastforwardPressed() { 1946void QtRec::FastforwardPressed() {
1948 if( ListView1->currentItem() == 0) return; 1947 if( ListView1->currentItem() == 0) return;
1949 if( !wavFile->track.isOpen()) 1948 if( !wavFile->track.isOpen())
1950 if( !openPlayFile() ) 1949 if( !openPlayFile() )
1951 return; 1950 return;
1952 else 1951 else
1953 if( !setupAudio( false)) 1952 if( !setupAudio( false))
@@ -1993,25 +1992,25 @@ QString QtRec::getStorage(const QString &fileName) {
1993 const QList<FileSystem> &fs = storageInfo.fileSystems(); 1992 const QList<FileSystem> &fs = storageInfo.fileSystems();
1994 QListIterator<FileSystem> it ( fs ); 1993 QListIterator<FileSystem> it ( fs );
1995 QString storage; 1994 QString storage;
1996 for( ; it.current(); ++it ){ 1995 for( ; it.current(); ++it ){
1997 const QString name = ( *it)->name(); 1996 const QString name = ( *it)->name();
1998 const QString path = ( *it)->path(); 1997 const QString path = ( *it)->path();
1999 const QString disk = ( *it)->disk(); 1998 const QString disk = ( *it)->disk();
2000 if( fileName.find( path,0,true) != -1) 1999 if( fileName.find( path,0,true) != -1)
2001 storage = name; 2000 storage = name;
2002 // const QString options = (*it)->options(); 2001 // const QString options = (*it)->options();
2003 // if( name.find( tr("Internal"),0,true) == -1) { 2002 // if( name.find( tr("Internal"),0,true) == -1) {
2004 // storageComboBox->insertItem( name +" -> "+disk); 2003 // storageComboBox->insertItem( name +" -> "+disk);
2005 // qDebug(name); 2004 // odebug << name << oendl;
2006 } 2005 }
2007 return storage; 2006 return storage;
2008 // struct mntent *me; 2007 // struct mntent *me;
2009 // // if(fileName == "/etc/mtab") { 2008 // // if(fileName == "/etc/mtab") {
2010 // FILE *mntfp = setmntent( fileName.latin1(), "r" ); 2009 // FILE *mntfp = setmntent( fileName.latin1(), "r" );
2011 // if ( mntfp ) { 2010 // if ( mntfp ) {
2012 // while ( (me = getmntent( mntfp )) != 0 ) { 2011 // while ( (me = getmntent( mntfp )) != 0 ) {
2013 // QString filesystemType = me->mnt_type; 2012 // QString filesystemType = me->mnt_type;
2014 2013
2015 // } 2014 // }
2016 // } 2015 // }
2017 // endmntent( mntfp ); 2016 // endmntent( mntfp );
diff --git a/noncore/multimedia/opierec/wavFile.cpp b/noncore/multimedia/opierec/wavFile.cpp
index 35bc14d..7e9b50f 100644
--- a/noncore/multimedia/opierec/wavFile.cpp
+++ b/noncore/multimedia/opierec/wavFile.cpp
@@ -1,274 +1,277 @@
1//wavFile.cpp 1//wavFile.cpp
2#include "wavFile.h" 2#include "wavFile.h"
3#include "qtrec.h" 3#include "qtrec.h"
4 4
5/* OPIE */
6#include <opie2/odebug.h>
7#include <qpe/config.h>
8using namespace Opie::Core;
9
10/* QT */
5#include <qmessagebox.h> 11#include <qmessagebox.h>
6#include <qdir.h> 12#include <qdir.h>
7 13
8#include <qpe/config.h> 14/* STD */
9
10#include <errno.h> 15#include <errno.h>
11
12#include <sys/time.h> 16#include <sys/time.h>
13#include <sys/types.h> 17#include <sys/types.h>
14#include <sys/vfs.h> 18#include <sys/vfs.h>
15
16#include <fcntl.h> 19#include <fcntl.h>
17#include <math.h> 20#include <math.h>
18#include <mntent.h> 21#include <mntent.h>
19#include <stdio.h> 22#include <stdio.h>
20#include <stdlib.h> 23#include <stdlib.h>
21#include <unistd.h> 24#include <unistd.h>
22 25
23WavFile::WavFile( QObject * parent,const QString &fileName, bool makeNwFile, int sampleRate, 26WavFile::WavFile( QObject * parent,const QString &fileName, bool makeNwFile, int sampleRate,
24 int channels, int resolution, int format ) 27 int channels, int resolution, int format )
25 : QObject( parent) 28 : QObject( parent)
26{ 29{
27//qDebug("new wave file"); 30//odebug << "new wave file" << oendl;
28 bool b = makeNwFile; 31 bool b = makeNwFile;
29 wavSampleRate=sampleRate; 32 wavSampleRate=sampleRate;
30 wavFormat=format; 33 wavFormat=format;
31 wavChannels=channels; 34 wavChannels=channels;
32 wavResolution=resolution; 35 wavResolution=resolution;
33 useTmpFile=false; 36 useTmpFile=false;
34 if( b) { 37 if( b) {
35 newFile(); 38 newFile();
36 } else { 39 } else {
37 openFile(fileName); 40 openFile(fileName);
38 } 41 }
39} 42}
40 43
41bool WavFile::newFile() { 44bool WavFile::newFile() {
42 45
43// qDebug("Set up new file"); 46// odebug << "Set up new file" << oendl;
44 Config cfg("OpieRec"); 47 Config cfg("OpieRec");
45 cfg.setGroup("Settings"); 48 cfg.setGroup("Settings");
46 49
47 currentFileName=cfg.readEntry("directory",QDir::homeDirPath()); 50 currentFileName=cfg.readEntry("directory",QDir::homeDirPath());
48 QString date; 51 QString date;
49 QDateTime dt = QDateTime::currentDateTime(); 52 QDateTime dt = QDateTime::currentDateTime();
50 date = dt.toString();//TimeString::dateString( QDateTime::currentDateTime(),false,true); 53 date = dt.toString();//TimeString::dateString( QDateTime::currentDateTime(),false,true);
51 date.replace(QRegExp("'"),""); 54 date.replace(QRegExp("'"),"");
52 date.replace(QRegExp(" "),"_"); 55 date.replace(QRegExp(" "),"_");
53 date.replace(QRegExp(":"),"."); 56 date.replace(QRegExp(":"),".");
54 date.replace(QRegExp(","),""); 57 date.replace(QRegExp(","),"");
55 58
56 QString currentFile=date; 59 QString currentFile=date;
57 if(currentFileName.right(1).find("/",0,true) == -1) 60 if(currentFileName.right(1).find("/",0,true) == -1)
58 currentFileName += "/" + date; 61 currentFileName += "/" + date;
59 else 62 else
60 currentFileName += date; 63 currentFileName += date;
61 currentFileName+=".wav"; 64 currentFileName+=".wav";
62 65
63// qDebug("set up file for recording: "+currentFileName); 66// odebug << "set up file for recording: "+currentFileName << oendl;
64 char pointer[] = "/tmp/opierec-XXXXXX"; 67 char pointer[] = "/tmp/opierec-XXXXXX";
65 int fd = 0; 68 int fd = 0;
66 69
67 if( currentFileName.find("/mnt",0,true) == -1 70 if( currentFileName.find("/mnt",0,true) == -1
68 && currentFileName.find("/tmp",0,true) == -1 ) { 71 && currentFileName.find("/tmp",0,true) == -1 ) {
69 // if destination file is most likely in flash (assuming jffs2) 72 // if destination file is most likely in flash (assuming jffs2)
70 // we have to write to a different filesystem first 73 // we have to write to a different filesystem first
71 74
72 useTmpFile = true; 75 useTmpFile = true;
73 if(( fd = mkstemp( pointer)) < 0 ) { 76 if(( fd = mkstemp( pointer)) < 0 ) {
74 perror("mkstemp failed"); 77 perror("mkstemp failed");
75 return false; 78 return false;
76 } 79 }
77 80
78// qDebug("Opening tmp file %s",pointer); 81// odebug << "Opening tmp file " << pointer << "" << oendl;
79 track.setName( pointer); 82 track.setName( pointer);
80 83
81 } else { //just use regular file.. no moving 84 } else { //just use regular file.. no moving
82 85
83 useTmpFile = false; 86 useTmpFile = false;
84 track.setName( currentFileName); 87 track.setName( currentFileName);
85 } 88 }
86 if(!track.open( IO_ReadWrite | IO_Truncate)) { 89 if(!track.open( IO_ReadWrite | IO_Truncate)) {
87 QString errorMsg=(QString)strerror(errno); 90 QString errorMsg=(QString)strerror(errno);
88 qDebug(errorMsg); 91 odebug << errorMsg << oendl;
89 QMessageBox::message("Note", "Error opening file.\n" +errorMsg); 92 QMessageBox::message("Note", "Error opening file.\n" +errorMsg);
90 93
91 return false; 94 return false;
92 } else { 95 } else {
93 setWavHeader( track.handle() , &hdr); 96 setWavHeader( track.handle() , &hdr);
94 } 97 }
95return true; 98return true;
96} 99}
97 100
98WavFile::~WavFile() { 101WavFile::~WavFile() {
99 102
100 closeFile(); 103 closeFile();
101} 104}
102 105
103void WavFile::closeFile() { 106void WavFile::closeFile() {
104 if(track.isOpen()) 107 if(track.isOpen())
105 track.close(); 108 track.close();
106} 109}
107 110
108int WavFile::openFile(const QString &currentFileName) { 111int WavFile::openFile(const QString &currentFileName) {
109// qDebug("open play file "+currentFileName); 112// odebug << "open play file "+currentFileName << oendl;
110 closeFile(); 113 closeFile();
111 114
112 track.setName(currentFileName); 115 track.setName(currentFileName);
113 116
114 if(!track.open(IO_ReadOnly)) { 117 if(!track.open(IO_ReadOnly)) {
115 QString errorMsg=(QString)strerror(errno); 118 QString errorMsg=(QString)strerror(errno);
116 qDebug("<<<<<<<<<<< "+errorMsg+currentFileName); 119 odebug << "<<<<<<<<<<< "+errorMsg+currentFileName << oendl;
117 QMessageBox::message("Note", "Error opening file.\n" +errorMsg); 120 QMessageBox::message("Note", "Error opening file.\n" +errorMsg);
118 return -1; 121 return -1;
119 } else { 122 } else {
120 parseWavHeader( track.handle()); 123 parseWavHeader( track.handle());
121 } 124 }
122 return track.handle(); 125 return track.handle();
123} 126}
124 127
125bool WavFile::setWavHeader(int fd, wavhdr *hdr) { 128bool WavFile::setWavHeader(int fd, wavhdr *hdr) {
126 129
127 strncpy((*hdr).riffID, "RIFF", 4); // RIFF 130 strncpy((*hdr).riffID, "RIFF", 4); // RIFF
128 strncpy((*hdr).wavID, "WAVE", 4); //WAVE 131 strncpy((*hdr).wavID, "WAVE", 4); //WAVE
129 strncpy((*hdr).fmtID, "fmt ", 4); // fmt 132 strncpy((*hdr).fmtID, "fmt ", 4); // fmt
130 (*hdr).fmtLen = 16; // format length = 16 133 (*hdr).fmtLen = 16; // format length = 16
131 134
132 if( wavFormat == WAVE_FORMAT_PCM) { 135 if( wavFormat == WAVE_FORMAT_PCM) {
133 (*hdr).fmtTag = 1; // PCM 136 (*hdr).fmtTag = 1; // PCM
134// qDebug("set header WAVE_FORMAT_PCM"); 137// odebug << "set header WAVE_FORMAT_PCM" << oendl;
135 } 138 }
136 else { 139 else {
137 (*hdr).fmtTag = WAVE_FORMAT_DVI_ADPCM; //intel ADPCM 140 (*hdr).fmtTag = WAVE_FORMAT_DVI_ADPCM; //intel ADPCM
138 // qDebug("set header WAVE_FORMAT_DVI_ADPCM"); 141 // odebug << "set header WAVE_FORMAT_DVI_ADPCM" << oendl;
139 } 142 }
140 143
141 // (*hdr).nChannels = 1;//filePara.channels;// ? 2 : 1*/; // channels 144 // (*hdr).nChannels = 1;//filePara.channels;// ? 2 : 1*/; // channels
142 (*hdr).nChannels = wavChannels;// ? 2 : 1*/; // channels 145 (*hdr).nChannels = wavChannels;// ? 2 : 1*/; // channels
143 146
144 (*hdr).sampleRate = wavSampleRate; //samples per second 147 (*hdr).sampleRate = wavSampleRate; //samples per second
145 (*hdr).avgBytesPerSec = (wavSampleRate)*( wavChannels*(wavResolution/8)); // bytes per second 148 (*hdr).avgBytesPerSec = (wavSampleRate)*( wavChannels*(wavResolution/8)); // bytes per second
146 (*hdr).nBlockAlign = wavChannels*( wavResolution/8); //block align 149 (*hdr).nBlockAlign = wavChannels*( wavResolution/8); //block align
147 (*hdr).bitsPerSample = wavResolution; //bits per sample 8, or 16 150 (*hdr).bitsPerSample = wavResolution; //bits per sample 8, or 16
148 151
149 strncpy((*hdr).dataID, "data", 4); 152 strncpy((*hdr).dataID, "data", 4);
150 153
151 write( fd,hdr, sizeof(*hdr)); 154 write( fd,hdr, sizeof(*hdr));
152 qDebug("writing header: bitrate%d, samplerate %d, channels %d", 155 qDebug("writing header: bitrate%d, samplerate %d, channels %d",
153 wavResolution, wavSampleRate, wavChannels); 156 wavResolution, wavSampleRate, wavChannels);
154 return true; 157 return true;
155} 158}
156 159
157bool WavFile::adjustHeaders(int fd, int total) { 160bool WavFile::adjustHeaders(int fd, int total) {
158 lseek(fd, 4, SEEK_SET); 161 lseek(fd, 4, SEEK_SET);
159 int i = total + 36; 162 int i = total + 36;
160 write( fd, &i, sizeof(i)); 163 write( fd, &i, sizeof(i));
161 lseek( fd, 40, SEEK_SET); 164 lseek( fd, 40, SEEK_SET);
162 write( fd, &total, sizeof(total)); 165 write( fd, &total, sizeof(total));
163 qDebug("adjusting header %d", total); 166 odebug << "adjusting header " << total << "" << oendl;
164 return true; 167 return true;
165} 168}
166 169
167int WavFile::parseWavHeader(int fd) { 170int WavFile::parseWavHeader(int fd) {
168 qDebug("Parsing wav header"); 171 odebug << "Parsing wav header" << oendl;
169 char string[4]; 172 char string[4];
170 int found; 173 int found;
171 short fmt; 174 short fmt;
172 unsigned short ch, bitrate; 175 unsigned short ch, bitrate;
173 unsigned long samplerrate, longdata; 176 unsigned long samplerrate, longdata;
174 177
175 if (read(fd, string, 4) < 4) { 178 if (read(fd, string, 4) < 4) {
176 qDebug(" Could not read from sound file.\n"); 179 odebug << " Could not read from sound file.\n" << oendl;
177 return -1; 180 return -1;
178 } 181 }
179 if (strncmp(string, "RIFF", 4)) { 182 if (strncmp(string, "RIFF", 4)) {
180 qDebug(" not a valid WAV file.\n"); 183 odebug << " not a valid WAV file.\n" << oendl;
181 return -1; 184 return -1;
182 } 185 }
183 lseek(fd, 4, SEEK_CUR); 186 lseek(fd, 4, SEEK_CUR);
184 if (read(fd, string, 4) < 4) { 187 if (read(fd, string, 4) < 4) {
185 qDebug("Could not read from sound file.\n"); 188 odebug << "Could not read from sound file.\n" << oendl;
186 return -1; 189 return -1;
187 } 190 }
188 if (strncmp(string, "WAVE", 4)) { 191 if (strncmp(string, "WAVE", 4)) {
189 qDebug("not a valid WAV file.\n"); 192 odebug << "not a valid WAV file.\n" << oendl;
190 return -1; 193 return -1;
191 } 194 }
192 found = 0; 195 found = 0;
193 196
194 while (!found) { 197 while (!found) {
195 if (read(fd, string, 4) < 4) { 198 if (read(fd, string, 4) < 4) {
196 qDebug("Could not read from sound file.\n"); 199 odebug << "Could not read from sound file.\n" << oendl;
197 return -1; 200 return -1;
198 } 201 }
199 if (strncmp(string, "fmt ", 4)) { 202 if (strncmp(string, "fmt ", 4)) {
200 if (read(fd, &longdata, 4) < 4) { 203 if (read(fd, &longdata, 4) < 4) {
201 qDebug("Could not read from sound file.\n"); 204 odebug << "Could not read from sound file.\n" << oendl;
202 return -1; 205 return -1;
203 } 206 }
204 lseek(fd, longdata, SEEK_CUR); 207 lseek(fd, longdata, SEEK_CUR);
205 } else { 208 } else {
206 lseek(fd, 4, SEEK_CUR); 209 lseek(fd, 4, SEEK_CUR);
207 if (read(fd, &fmt, 2) < 2) { 210 if (read(fd, &fmt, 2) < 2) {
208 qDebug("Could not read format chunk.\n"); 211 odebug << "Could not read format chunk.\n" << oendl;
209 return -1; 212 return -1;
210 } 213 }
211 if (fmt != WAVE_FORMAT_PCM && fmt != WAVE_FORMAT_DVI_ADPCM) { 214 if (fmt != WAVE_FORMAT_PCM && fmt != WAVE_FORMAT_DVI_ADPCM) {
212 qDebug("Wave file contains unknown format." 215 qDebug("Wave file contains unknown format."
213 " Unable to continue.\n"); 216 " Unable to continue.\n");
214 return -1; 217 return -1;
215 } 218 }
216 wavFormat = fmt; 219 wavFormat = fmt;
217 // compressionFormat=fmt; 220 // compressionFormat=fmt;
218 qDebug("compressionFormat is %d", fmt); 221 odebug << "compressionFormat is " << fmt << "" << oendl;
219 if (read(fd, &ch, 2) < 2) { 222 if (read(fd, &ch, 2) < 2) {
220 qDebug("Could not read format chunk.\n"); 223 odebug << "Could not read format chunk.\n" << oendl;
221 return -1; 224 return -1;
222 } else { 225 } else {
223 wavChannels = ch; 226 wavChannels = ch;
224 qDebug("File has %d channels", ch); 227 odebug << "File has " << ch << " channels" << oendl;
225 } 228 }
226 if (read(fd, &samplerrate, 4) < 4) { 229 if (read(fd, &samplerrate, 4) < 4) {
227 qDebug("Could not read from format chunk.\n"); 230 odebug << "Could not read from format chunk.\n" << oendl;
228 return -1; 231 return -1;
229 } else { 232 } else {
230 wavSampleRate = samplerrate; 233 wavSampleRate = samplerrate;
231 // sampleRate = samplerrate; 234 // sampleRate = samplerrate;
232 qDebug("File has samplerate of %d",(int) samplerrate); 235 odebug << "File has samplerate of " << (int) samplerrate << "" << oendl;
233 } 236 }
234 lseek(fd, 6, SEEK_CUR); 237 lseek(fd, 6, SEEK_CUR);
235 if (read(fd, &bitrate, 2) < 2) { 238 if (read(fd, &bitrate, 2) < 2) {
236 qDebug("Could not read format chunk.\n"); 239 odebug << "Could not read format chunk.\n" << oendl;
237 return -1; 240 return -1;
238 } else { 241 } else {
239 wavResolution=bitrate; 242 wavResolution=bitrate;
240 // resolution = bitrate; 243 // resolution = bitrate;
241 qDebug("File has bitrate of %d", bitrate); 244 odebug << "File has bitrate of " << bitrate << "" << oendl;
242 } 245 }
243 found++; 246 found++;
244 } 247 }
245 } 248 }
246 found = 0; 249 found = 0;
247 while (!found) { 250 while (!found) {
248 if (read(fd, string, 4) < 4) { 251 if (read(fd, string, 4) < 4) {
249 qDebug("Could not read from sound file.\n"); 252 odebug << "Could not read from sound file.\n" << oendl;
250 return -1; 253 return -1;
251 } 254 }
252 255
253 if (strncmp(string, "data", 4)) { 256 if (strncmp(string, "data", 4)) {
254 if (read(fd, &longdata, 4)<4) { 257 if (read(fd, &longdata, 4)<4) {
255 qDebug("Could not read from sound file.\n"); 258 odebug << "Could not read from sound file.\n" << oendl;
256 return -1; 259 return -1;
257 } 260 }
258 261
259 lseek(fd, longdata, SEEK_CUR); 262 lseek(fd, longdata, SEEK_CUR);
260 } else { 263 } else {
261 if (read(fd, &longdata, 4) < 4) { 264 if (read(fd, &longdata, 4) < 4) {
262 qDebug("Could not read from sound file.\n"); 265 odebug << "Could not read from sound file.\n" << oendl;
263 return -1; 266 return -1;
264 } else { 267 } else {
265 wavNumberSamples = longdata; 268 wavNumberSamples = longdata;
266 qDebug("file has length of %d \nlasting %d seconds", (int)longdata, 269 qDebug("file has length of %d \nlasting %d seconds", (int)longdata,
267 (int)(( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)) ); 270 (int)(( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)) );
268// wavSeconds = (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)); 271// wavSeconds = (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8));
269 272
270 return longdata; 273 return longdata;
271 } 274 }
272 } 275 }
273 } 276 }
274 277
diff --git a/noncore/multimedia/opierec/waveform.cpp b/noncore/multimedia/opierec/waveform.cpp
index 9cc40b4..7c9a25f 100644
--- a/noncore/multimedia/opierec/waveform.cpp
+++ b/noncore/multimedia/opierec/waveform.cpp
@@ -10,46 +10,50 @@
10 ** 10 **
11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 ** 13 **
14 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 14 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
15 ** 15 **
16 ** Contact info@trolltech.com if any conditions of this licensing are 16 ** Contact info@trolltech.com if any conditions of this licensing are
17 ** not clear to you. 17 ** not clear to you.
18 ** 18 **
19 **********************************************************************/ 19 **********************************************************************/
20#include "waveform.h" 20#include "waveform.h"
21 21
22#include <qpainter.h> 22/* OPIE */
23#include <opie2/odebug.h>
24using namespace Opie::Core;
23 25
26/* QT */
27#include <qpainter.h>
24 28
25Waveform::Waveform( QWidget *parent, const char *name, WFlags fl ) 29Waveform::Waveform( QWidget *parent, const char *name, WFlags fl )
26 : QWidget( parent, name, fl ) 30 : QWidget( parent, name, fl )
27{ 31{
28 pixmap = 0; 32 pixmap = 0;
29 windowSize = 100; 33 windowSize = 100;
30 samplesPerPixel = 8000 / (5 * windowSize); 34 samplesPerPixel = 8000 / (5 * windowSize);
31 currentValue = 0; 35 currentValue = 0;
32 numSamples = 0; 36 numSamples = 0;
33 windowPosn = 0; 37 windowPosn = 0;
34 window = 0; 38 window = 0;
35} 39}
36 40
37 41
38void Waveform::changeSettings( int frequency, int channels ) 42void Waveform::changeSettings( int frequency, int channels )
39{ 43{
40 makePixmap(); 44 makePixmap();
41// qWarning("change waveform %d, %d", frequency, channels); 45// owarn << "change waveform " << frequency << ", " << channels << "" << oendl;
42 samplesPerPixel = frequency * channels / (5 * windowSize); 46 samplesPerPixel = frequency * channels / (5 * windowSize);
43 qWarning("Waveform::changeSettings %d", samplesPerPixel); 47 owarn << "Waveform::changeSettings " << samplesPerPixel << "" << oendl;
44 if ( !samplesPerPixel ) 48 if ( !samplesPerPixel )
45 samplesPerPixel = 1; 49 samplesPerPixel = 1;
46 currentValue = 0; 50 currentValue = 0;
47 numSamples = 0; 51 numSamples = 0;
48 windowPosn = 0; 52 windowPosn = 0;
49 draw(); 53 draw();
50} 54}
51 55
52 56
53Waveform::~Waveform() 57Waveform::~Waveform()
54{ 58{
55 if ( window ) 59 if ( window )
@@ -87,25 +91,25 @@ void Waveform::newSamples( const short *buf, int len )
87 window[windowPosn++] = (short)(currentValue / numSamples); 91 window[windowPosn++] = (short)(currentValue / numSamples);
88 if ( windowPosn >= windowSize ) { 92 if ( windowPosn >= windowSize ) {
89 this->windowPosn = windowPosn; 93 this->windowPosn = windowPosn;
90 draw(); 94 draw();
91 windowPosn = 0; 95 windowPosn = 0;
92 } 96 }
93 numSamples = 0; 97 numSamples = 0;
94 currentValue = 0; 98 currentValue = 0;
95 } 99 }
96 } 100 }
97 101
98 // Copy the final state back to the object. 102 // Copy the final state back to the object.
99//qWarning("%d, %d, %d", currentValue, numSamples, windowPosn); 103//owarn << "" << currentValue << ", " << numSamples << ", " << windowPosn << "" << oendl;
100 this->currentValue = currentValue; 104 this->currentValue = currentValue;
101 this->numSamples = numSamples; 105 this->numSamples = numSamples;
102 this->windowPosn = windowPosn; 106 this->windowPosn = windowPosn;
103} 107}
104 108
105 109
106void Waveform::makePixmap() 110void Waveform::makePixmap()
107{ 111{
108 if ( !pixmap ) { 112 if ( !pixmap ) {
109 pixmap = new QPixmap( size() ); 113 pixmap = new QPixmap( size() );
110 windowSize = pixmap->width(); 114 windowSize = pixmap->width();
111 window = new short [windowSize]; 115 window = new short [windowSize];
diff --git a/noncore/multimedia/powerchord/config.in b/noncore/multimedia/powerchord/config.in
index ab1512b..5db784a 100644
--- a/noncore/multimedia/powerchord/config.in
+++ b/noncore/multimedia/powerchord/config.in
@@ -1,7 +1,7 @@
1 config POWERCHORD 1 config POWERCHORD
2 boolean "opie-powerchord (guitar chord generator and tuning)" 2 boolean "opie-powerchord (guitar chord generator and tuning)"
3 default "n" 3 default "n"
4 depends ( LIBQPE || LIBQPE-X11 ) 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE
5 comment "opie-powerchord needs a libqpe" 5 comment "opie-powerchord needs a libqpe and libopiecore2"
6 depends !(( LIBQPE || LIBQPE-X11 ) ) 6 depends !(( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE )
7 7
diff --git a/noncore/multimedia/powerchord/powerchord.pro b/noncore/multimedia/powerchord/powerchord.pro
index 917c88f..f7af6d6 100644
--- a/noncore/multimedia/powerchord/powerchord.pro
+++ b/noncore/multimedia/powerchord/powerchord.pro
@@ -9,19 +9,18 @@ HEADERS = powerchord.h \
9 powerchordbase.h 9 powerchordbase.h
10 10
11 SOURCES = main.cpp \ 11 SOURCES = main.cpp \
12 powerchord.cpp \ 12 powerchord.cpp \
13 fretboard.cpp \ 13 fretboard.cpp \
14 chordengine.cpp \ 14 chordengine.cpp \
15 vumeter.cpp \ 15 vumeter.cpp \
16 gs.cpp gt.cpp \ 16 gs.cpp gt.cpp \
17 powerchordbase.cpp 17 powerchordbase.cpp
18 18
19 INCLUDEPATH+= $(OPIEDIR)/include 19 INCLUDEPATH+= $(OPIEDIR)/include
20 DEPENDPATH+= $(OPIEDIR)/include 20 DEPENDPATH+= $(OPIEDIR)/include
21LIBS += -lqpe 21LIBS += -lqpe -lopiecore2
22 #INTERFACES= powerchordbase.ui
23DESTDIR = $(OPIEDIR)/bin 22DESTDIR = $(OPIEDIR)/bin
24 TARGET = powerchord 23 TARGET = powerchord
25 24
26include ( $(OPIEDIR)/include.pro ) 25include ( $(OPIEDIR)/include.pro )
27 26
diff --git a/noncore/multimedia/powerchord/powerchordbase.cpp b/noncore/multimedia/powerchord/powerchordbase.cpp
index 4fb5dda..0694ba3 100644
--- a/noncore/multimedia/powerchord/powerchordbase.cpp
+++ b/noncore/multimedia/powerchord/powerchordbase.cpp
@@ -1,34 +1,38 @@
1/**************************************************************************** 1/****************************************************************************
2** Form implementation generated from reading ui file 'powerchordbase.ui' 2** Form implementation generated from reading ui file 'powerchordbase.ui'
3** 3**
4** Created: Sun Jan 13 23:05:11 2002 4** Created: Sun Jan 13 23:05:11 2002
5** by: The User Interface Compiler (uic) 5** by: The User Interface Compiler (uic)
6** 6**
7** WARNING! All changes made in this file will be lost! 7** WARNING! All changes made in this file will be lost!
8****************************************************************************/ 8****************************************************************************/
9#include "powerchordbase.h" 9#include "powerchordbase.h"
10
11#include "fretboard.h" 10#include "fretboard.h"
12#include "vumeter.h" 11#include "vumeter.h"
12
13/* OPIE */
14#include <opie2/odebug.h>
15#include <qpe/resource.h>
16using namespace Opie::Core;
17
18/* QT */
13#include <qcombobox.h> 19#include <qcombobox.h>
14#include <qlabel.h> 20#include <qlabel.h>
15#include <qlistbox.h> 21#include <qlistbox.h>
16#include <qpushbutton.h> 22#include <qpushbutton.h>
17#include <qspinbox.h> 23#include <qspinbox.h>
18#include <qtabwidget.h> 24#include <qtabwidget.h>
19#include <qlayout.h> 25#include <qlayout.h>
20#include <qtooltip.h> 26#include <qtooltip.h>
21#include <qpe/resource.h>
22
23 27
24/* 28/*
25 * Constructs a PowerchordBase which is a child of 'parent', with the 29 * Constructs a PowerchordBase which is a child of 'parent', with the
26 * name 'name' and widget flags set to 'f' 30 * name 'name' and widget flags set to 'f'
27 */ 31 */
28PowerchordBase::PowerchordBase( QWidget* parent, const char* name, WFlags fl ) 32PowerchordBase::PowerchordBase( QWidget* parent, const char* name, WFlags fl )
29 : QWidget( parent, name, fl ) 33 : QWidget( parent, name, fl )
30{ 34{
31 simulation_timer = 0; 35 simulation_timer = 0;
32 audio_timer = 0; 36 audio_timer = 0;
33 37
34 // setPalette( QPalette( QColor( 232, 227, 215) ) ); 38 // setPalette( QPalette( QColor( 232, 227, 215) ) );
@@ -571,15 +575,15 @@ void PowerchordBase::tuner_simulation_cb(){
571} 575}
572 576
573/* 577/*
574 * Destroys the object and frees any allocated resources 578 * Destroys the object and frees any allocated resources
575 */ 579 */
576PowerchordBase::~PowerchordBase() 580PowerchordBase::~PowerchordBase()
577{ 581{
578 // no need to delete child widgets, Qt does it all for us 582 // no need to delete child widgets, Qt does it all for us
579} 583}
580 584
581void PowerchordBase::change_handler() 585void PowerchordBase::change_handler()
582{ 586{
583 qWarning( "PowerchordBase::change_handler(): Not implemented yet!" ); 587 owarn << "PowerchordBase::change_handler(): Not implemented yet!" << oendl;
584} 588}
585 589
diff --git a/noncore/multimedia/showimg/ImageFileSelector.cpp b/noncore/multimedia/showimg/ImageFileSelector.cpp
index 79ee925..53cc883 100644
--- a/noncore/multimedia/showimg/ImageFileSelector.cpp
+++ b/noncore/multimedia/showimg/ImageFileSelector.cpp
@@ -1,23 +1,25 @@
1#include "ImageFileSelector.h"
1 2
3/* OPIE */
4#include <opie2/odebug.h>
5#include <qpe/qpeapplication.h>
6using namespace Opie::Core;
2 7
3#include "qpe/qpeapplication.h" 8/* QT */
4 9#include <qlabel.h>
5#include <stdlib.h>
6
7#include <qlabel.h>
8#include <qfileinfo.h> 10#include <qfileinfo.h>
9 11
10#include "ImageFileSelector.h" 12/* STD */
11 13#include <stdlib.h>
12 14
13ThumbWidget::ThumbWidget(QPixmap p,QString text,const DocLnk& f,QWidget *parent,int w) 15ThumbWidget::ThumbWidget(QPixmap p,QString text,const DocLnk& f,QWidget *parent,int w)
14 : QWidget( parent ),fl(f) 16 : QWidget( parent ),fl(f)
15{ 17{
16 setBackgroundMode(NoBackground); 18 setBackgroundMode(NoBackground);
17 if ( w!=-1 ) 19 if ( w!=-1 )
18 setMinimumSize(w,p.height()+24); 20 setMinimumSize(w,p.height()+24);
19 else 21 else
20 setMinimumSize(p.width(),p.height()+24); 22 setMinimumSize(p.width(),p.height()+24);
21 description=new QLabel(text,this); 23 description=new QLabel(text,this);
22 description->setBackgroundColor(colorGroup().base()); 24 description->setBackgroundColor(colorGroup().base());
23 description->setAlignment(AlignCenter); 25 description->setAlignment(AlignCenter);
@@ -146,25 +148,25 @@ void ImageFileSelector::resizeEvent(QResizeEvent *)
146void ImageFileSelector::updateSizes() 148void ImageFileSelector::updateSizes()
147{ 149{
148 int ww=(detailed->width()-detailed->frameWidth()*2); 150 int ww=(detailed->width()-detailed->frameWidth()*2);
149 double w=(double)ww*0.70; 151 double w=(double)ww*0.70;
150 detailed->setColumnWidth(0,(int)w); 152 detailed->setColumnWidth(0,(int)w);
151 detailed->setColumnWidth(1,ww-(int)w); 153 detailed->setColumnWidth(1,ww-(int)w);
152 background->setMinimumWidth(thumb->visibleWidth()); 154 background->setMinimumWidth(thumb->visibleWidth());
153 thumb->updateScrollBars(); 155 thumb->updateScrollBars();
154} 156}
155 157
156void ImageFileSelector::reread(bool) 158void ImageFileSelector::reread(bool)
157{ 159{
158// qDebug("reread"); 160// odebug << "reread" << oendl;
159 ImageFileSelectorItem *item = (ImageFileSelectorItem *)detailed->selectedItem(); 161 ImageFileSelectorItem *item = (ImageFileSelectorItem *)detailed->selectedItem();
160 QString oldFile; 162 QString oldFile;
161 if ( item ) 163 if ( item )
162 oldFile = item->file().file(); 164 oldFile = item->file().file();
163 detailed->clear(); 165 detailed->clear();
164 tList.clear(); 166 tList.clear();
165 DocLnkSet files; 167 DocLnkSet files;
166 Global::findDocuments(&files, "image/*"); 168 Global::findDocuments(&files, "image/*");
167 count = files.children().count(); 169 count = files.children().count();
168 QListIterator<DocLnk> dit( files.children() ); 170 QListIterator<DocLnk> dit( files.children() );
169// int y=0; 171// int y=0;
170// int x=4; 172// int x=4;
@@ -212,25 +214,25 @@ void ImageFileSelector::reread(bool)
212 detailed->setUpdatesEnabled(true); 214 detailed->setUpdatesEnabled(true);
213 thumb->setUpdatesEnabled(true); 215 thumb->setUpdatesEnabled(true);
214 detailed->update(); 216 detailed->update();
215 thumb->update(); 217 thumb->update();
216} 218}
217 219
218int ImageFileSelector::fileCount() 220int ImageFileSelector::fileCount()
219{ 221{
220 return count; 222 return count;
221} 223}
222const DocLnk * ImageFileSelector::selected() 224const DocLnk * ImageFileSelector::selected()
223{ 225{
224 qDebug("image selected"); 226 odebug << "image selected" << oendl;
225 ImageFileSelectorItem *item = (ImageFileSelectorItem *) detailed->selectedItem(); 227 ImageFileSelectorItem *item = (ImageFileSelectorItem *) detailed->selectedItem();
226 if ( item ) 228 if ( item )
227 return new DocLnk( item->file() ); 229 return new DocLnk( item->file() );
228 return 0; 230 return 0;
229} 231}
230 232
231 233
232 234
233void ImageFileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, int ) 235void ImageFileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, int )
234{ 236{
235 if ( !i ) 237 if ( !i )
236 return; 238 return;
diff --git a/noncore/multimedia/showimg/showimg.cpp b/noncore/multimedia/showimg/showimg.cpp
index 696a57b..24377ed 100644
--- a/noncore/multimedia/showimg/showimg.cpp
+++ b/noncore/multimedia/showimg/showimg.cpp
@@ -17,41 +17,43 @@
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21// 21//
22// Full-screen and rotation options contributed by Robert Wittams <robert@wittams.com> 22// Full-screen and rotation options contributed by Robert Wittams <robert@wittams.com>
23// 23//
24 24
25#include "showimg.h" 25#include "showimg.h"
26#include "ImageFileSelector.h" 26#include "ImageFileSelector.h"
27#include "settingsdialog.h" 27#include "settingsdialog.h"
28 28
29 29/* OPIE */
30#include <opie2/odebug.h>
30#include <opie2/ofiledialog.h> 31#include <opie2/ofiledialog.h>
31
32#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
33#include <qpe/config.h> 33#include <qpe/config.h>
34#include <qpe/resource.h> 34#include <qpe/resource.h>
35#include <qtoolbar.h> 35using namespace Opie::Core;
36using namespace Opie::Ui;
36 37
38/* QT */
39#include <qtoolbar.h>
37#include <qaction.h> 40#include <qaction.h>
38#include <qfiledialog.h> 41#include <qfiledialog.h>
39#include <qmenubar.h> 42#include <qmenubar.h>
40#include <qspinbox.h> 43#include <qspinbox.h>
41 44
45/* STD */
42#include <math.h> 46#include <math.h>
43 47
44
45using namespace Opie::Ui;
46ControlsDialog::ControlsDialog(const QString &caption,QImage image,int *brightness,QWidget *parent) 48ControlsDialog::ControlsDialog(const QString &caption,QImage image,int *brightness,QWidget *parent)
47 : QDialog(parent,0,true) 49 : QDialog(parent,0,true)
48{ 50{
49 setCaption(caption); 51 setCaption(caption);
50 52
51 if ( parent ) { 53 if ( parent ) {
52 setPalette(parent->palette()); 54 setPalette(parent->palette());
53 } 55 }
54 56
55 b=brightness; 57 b=brightness;
56 img=image; 58 img=image;
57 59
@@ -277,25 +279,25 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int /*wFlags*/ )
277 279
278 280
279 imagePanel = new ImagePane( stack ); 281 imagePanel = new ImagePane( stack );
280 connect(imagePanel, SIGNAL(clicked()), this, SLOT(normalView())); 282 connect(imagePanel, SIGNAL(clicked()), this, SLOT(normalView()));
281 283
282 284
283 ImageFileSelector::CURRENT_VIEW cv; 285 ImageFileSelector::CURRENT_VIEW cv;
284 if(showThumbView) 286 if(showThumbView)
285 cv=ImageFileSelector::THUMBNAIL; 287 cv=ImageFileSelector::THUMBNAIL;
286 else 288 else
287 cv=ImageFileSelector::DETAILED; 289 cv=ImageFileSelector::DETAILED;
288 290
289 qDebug("cv = %d",cv); 291 odebug << "cv = " << cv << "" << oendl;
290 292
291 fileSelector = new ImageFileSelector( cv,stack, "fs"); 293 fileSelector = new ImageFileSelector( cv,stack, "fs");
292 294
293 //switchThumbView(); 295 //switchThumbView();
294 296
295 297
296 //fileSelector = new ImageFileSelector("image/*", stack, "fs"); 298 //fileSelector = new ImageFileSelector("image/*", stack, "fs");
297 //fileSelector->setNewVisible(FALSE); 299 //fileSelector->setNewVisible(FALSE);
298 //fileSelector->setCloseVisible(FALSE); 300 //fileSelector->setCloseVisible(FALSE);
299 connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( closeFileSelector() ) ); 301 connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( closeFileSelector() ) );
300 connect( fileSelector, SIGNAL( fileSelected(const DocLnk&) ), 302 connect( fileSelector, SIGNAL( fileSelected(const DocLnk&) ),
301 this, SLOT( openFile(const DocLnk&) ) ); 303 this, SLOT( openFile(const DocLnk&) ) );
@@ -404,25 +406,25 @@ void ImageViewer::help() {
404 406
405 407
406void ImageViewer::settings() 408void ImageViewer::settings()
407{ 409{
408 SettingsDialog dlg( this, 0, TRUE ); 410 SettingsDialog dlg( this, 0, TRUE );
409 dlg.setDelay( slideDelay ); 411 dlg.setDelay( slideDelay );
410 dlg.setRepeat( slideRepeat ); 412 dlg.setRepeat( slideRepeat );
411 dlg.setReverse( slideReverse ); 413 dlg.setReverse( slideReverse );
412 dlg.setRotate(rotateOnLoad); 414 dlg.setRotate(rotateOnLoad);
413 dlg.setFastLoad(fastLoad); 415 dlg.setFastLoad(fastLoad);
414 416
415 if ( QPEApplication::execDialog(&dlg) == QDialog::Accepted ) { 417 if ( QPEApplication::execDialog(&dlg) == QDialog::Accepted ) {
416 qDebug("<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>"); 418 odebug << "<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>" << oendl;
417 slideDelay = dlg.delay(); 419 slideDelay = dlg.delay();
418 slideRepeat = dlg.repeat(); 420 slideRepeat = dlg.repeat();
419 slideReverse = dlg.reverse(); 421 slideReverse = dlg.reverse();
420 rotateOnLoad = dlg.rotate(); 422 rotateOnLoad = dlg.rotate();
421 fastLoad = dlg.fastLoad(); 423 fastLoad = dlg.fastLoad();
422 424
423 Config config( "ImageViewer" ); 425 Config config( "ImageViewer" );
424 config.setGroup( "SlideShow" ); 426 config.setGroup( "SlideShow" );
425 config.writeEntry( "Delay", slideDelay ); 427 config.writeEntry( "Delay", slideDelay );
426 config.writeEntry( "Repeat", slideRepeat ); 428 config.writeEntry( "Repeat", slideRepeat );
427 config.writeEntry("Reverse", slideReverse); 429 config.writeEntry("Reverse", slideReverse);
428 430
@@ -496,25 +498,25 @@ void ImageViewer::doDelayedLoad()
496{ 498{
497 show(delayLoad); 499 show(delayLoad);
498} 500}
499 501
500void ImageViewer::show() 502void ImageViewer::show()
501{ 503{
502 normalView(); 504 normalView();
503 QMainWindow::show(); 505 QMainWindow::show();
504} 506}
505 507
506void ImageViewer::show(const QString& fileref) 508void ImageViewer::show(const QString& fileref)
507{ 509{
508// qDebug("Show "+fileref); 510// odebug << "Show "+fileref << oendl;
509 bFromDocView = TRUE; 511 bFromDocView = TRUE;
510 closeFileSelector(); 512 closeFileSelector();
511 DocLnk link(fileref); 513 DocLnk link(fileref);
512 if ( link.isValid() ) { 514 if ( link.isValid() ) {
513 openFile(link); 515 openFile(link);
514 } else { 516 } else {
515 filename = fileref; 517 filename = fileref;
516 updateCaption( fileref ); 518 updateCaption( fileref );
517 loadImage( fileref ); 519 loadImage( fileref );
518 } 520 }
519} 521}
520 522
@@ -526,25 +528,25 @@ void ImageViewer::openFile() {
526 528
527 QString str = OFileDialog::getOpenFileName( 1,QPEApplication::documentDir(),"", types, 0 ); 529 QString str = OFileDialog::getOpenFileName( 1,QPEApplication::documentDir(),"", types, 0 );
528 DocLnk link(str); 530 DocLnk link(str);
529// if ( link.isValid() ) 531// if ( link.isValid() )
530 openFile(link); 532 openFile(link);
531 533
532} 534}
533 535
534void ImageViewer::openFile( const DocLnk &link ) 536void ImageViewer::openFile( const DocLnk &link )
535{ 537{
536 closeFileSelector(); 538 closeFileSelector();
537// DocLnk link(file); 539// DocLnk link(file);
538 qDebug("open "+link.name()); 540 odebug << "open "+link.name() << oendl;
539 updateCaption( link.name() ); 541 updateCaption( link.name() );
540 loadImage( link.file() ); 542 loadImage( link.file() );
541 if (slideTimer->isActive()) { 543 if (slideTimer->isActive()) {
542 slideTimer->start(slideDelay * 1000, FALSE); 544 slideTimer->start(slideDelay * 1000, FALSE);
543 } 545 }
544 546
545} 547}
546 548
547void ImageViewer::open() 549void ImageViewer::open()
548{ 550{
549 switchToFileSelector(); 551 switchToFileSelector();
550} 552}
diff --git a/noncore/multimedia/showimg/showimg.pro b/noncore/multimedia/showimg/showimg.pro
index 6fd019e..c905da8 100644
--- a/noncore/multimedia/showimg/showimg.pro
+++ b/noncore/multimedia/showimg/showimg.pro
@@ -1,9 +1,9 @@
1CONFIG += qt warn_on quick-app 1CONFIG += qt warn_on quick-app
2HEADERS = showimg.h ImageFileSelector.h settingsdialog.h settingsdialogbase.h 2HEADERS = showimg.h ImageFileSelector.h settingsdialog.h settingsdialogbase.h
3SOURCES = main.cpp showimg.cpp ImageFileSelector.cpp settingsdialog.cpp settingsdialogbase.cpp 3SOURCES = main.cpp showimg.cpp ImageFileSelector.cpp settingsdialog.cpp settingsdialogbase.cpp
4TARGET = showimg 4TARGET = showimg
5INCLUDEPATH += $(OPIEDIR)/include 5INCLUDEPATH += $(OPIEDIR)/include
6DEPENDPATH += $(OPIEDIR)/include 6DEPENDPATH += $(OPIEDIR)/include
7LIBS += -lqpe -lopiecore2 -lopieui2 7LIBS += -lqpe -lopiecore2 -lopieui2
8 8
9include ( $(OPIEDIR)/include.pro ) 9include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/multimedia/tonleiter/config.in b/noncore/multimedia/tonleiter/config.in
index d580ad7..9bd167e 100644
--- a/noncore/multimedia/tonleiter/config.in
+++ b/noncore/multimedia/tonleiter/config.in
@@ -1,4 +1,4 @@
1 config TONLEITER 1 config TONLEITER
2 boolean "tonleiter (shows scales on sting instruments)" 2 boolean "tonleiter (shows scales on sting instruments)"
3 default "n" 3 default "n"
4 depends ( LIBQPE || LIBQPE-X11 ) 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE
diff --git a/noncore/multimedia/tonleiter/editinst.cpp b/noncore/multimedia/tonleiter/editinst.cpp
index ccb4560..a8c20c8 100644
--- a/noncore/multimedia/tonleiter/editinst.cpp
+++ b/noncore/multimedia/tonleiter/editinst.cpp
@@ -1,17 +1,22 @@
1#include "editinst.h" 1#include "editinst.h"
2 2
3#include <qpushbutton.h> 3/* OPIE */
4 4#include <opie2/odebug.h>
5#include <qpe/config.h>
5#include <qpe/qpeapplication.h> 6#include <qpe/qpeapplication.h>
7using namespace Opie::Core;
8
9/* QT */
10#include <qpushbutton.h>
6 11
7Menu::InstEditDialog::InstEditDialog(TonleiterData* data,QWidget* parent,const char* name) 12Menu::InstEditDialog::InstEditDialog(TonleiterData* data,QWidget* parent,const char* name)
8:QDialog(parent,name,true,0),data(data) 13:QDialog(parent,name,true,0),data(data)
9{ 14{
10 setCaption("Tonleiter::"+tr("Instrument")); 15 setCaption("Tonleiter::"+tr("Instrument"));
11 QBoxLayout* masterlayout=new QBoxLayout(this,QBoxLayout::TopToBottom); 16 QBoxLayout* masterlayout=new QBoxLayout(this,QBoxLayout::TopToBottom);
12 instid=data->getCurrentInstrumentID(); 17 instid=data->getCurrentInstrumentID();
13 stringlist.setAutoDelete(true); 18 stringlist.setAutoDelete(true);
14 19
15 QBoxLayout* toplayout=new QBoxLayout(masterlayout,QBoxLayout::LeftToRight); 20 QBoxLayout* toplayout=new QBoxLayout(masterlayout,QBoxLayout::LeftToRight);
16 21
17 //Name combo + Add + Delete 22 //Name combo + Add + Delete
@@ -91,20 +96,20 @@ void Menu::InstEditDialog::deleteString(int id)
91} 96}
92//**************************************************************************** 97//****************************************************************************
93void Menu::InstEditDialog::saveInstrument() 98void Menu::InstEditDialog::saveInstrument()
94{ 99{
95 //auto delete is set to true so widgets _should_ be deleted 100 //auto delete is set to true so widgets _should_ be deleted
96 stringlist.clear(); 101 stringlist.clear();
97} 102}
98//**************************************************************************** 103//****************************************************************************
99void Menu::InstEditDialog::loadInstrument() 104void Menu::InstEditDialog::loadInstrument()
100{ 105{
101 stringlist.clear(); 106 stringlist.clear();
102 Instrument inst=data->getInstrument(instid); 107 Instrument inst=data->getInstrument(instid);
103 qDebug("load Instrument : %d strings",inst.noOfStrings()); 108 odebug << "load Instrument : " << inst.noOfStrings() << " strings" << oendl;
104 for(uint s=0;s<inst.noOfStrings();s++) 109 for(uint s=0;s<inst.noOfStrings();s++)
105 { 110 {
106 stringlist.append(new EditStringWidget(inst.string(s),stringwidget)); 111 stringlist.append(new EditStringWidget(inst.string(s),stringwidget));
107 } 112 }
108} 113}
109//**************************************************************************** 114//****************************************************************************
110//**************************************************************************** 115//****************************************************************************
diff --git a/noncore/multimedia/tonleiter/fretboard.cpp b/noncore/multimedia/tonleiter/fretboard.cpp
index 7e63e01..58bdb86 100644
--- a/noncore/multimedia/tonleiter/fretboard.cpp
+++ b/noncore/multimedia/tonleiter/fretboard.cpp
@@ -1,14 +1,19 @@
1#include "fretboard.h" 1#include "fretboard.h"
2 2
3/* OPIE */
4#include <opie2/odebug.h>
5using namespace Opie::Core;
6
7/* QT */
3#include <qpainter.h> 8#include <qpainter.h>
4 9
5Graph::FretBoard::FretBoard(TonleiterData* data,QWidget* parent,const char* name,WFlags f) 10Graph::FretBoard::FretBoard(TonleiterData* data,QWidget* parent,const char* name,WFlags f)
6:QWidget(parent,name,f),data(data) 11:QWidget(parent,name,f),data(data)
7{ 12{
8 setBackgroundColor(QColor(0,0,0)); 13 setBackgroundColor(QColor(0,0,0));
9 fretpen=QPen(QColor(155,155,155),0); 14 fretpen=QPen(QColor(155,155,155),0);
10 markerbrush=QBrush(QColor(155,155,155)); 15 markerbrush=QBrush(QColor(155,155,155));
11 stringpen=QPen(QColor(255,255,255),3); 16 stringpen=QPen(QColor(255,255,255),3);
12 connect(data,SIGNAL(dataChange()),this,SLOT(dataChange())); 17 connect(data,SIGNAL(dataChange()),this,SLOT(dataChange()));
13} 18}
14//**************************************************************************** 19//****************************************************************************
@@ -18,25 +23,25 @@ Graph::FretBoard::~FretBoard()
18//**************************************************************************** 23//****************************************************************************
19void Graph::FretBoard::dataChange() 24void Graph::FretBoard::dataChange()
20{ 25{
21 repaint(true); 26 repaint(true);
22} 27}
23//**************************************************************************** 28//****************************************************************************
24void Graph::FretBoard::paintEvent(QPaintEvent* pe) 29void Graph::FretBoard::paintEvent(QPaintEvent* pe)
25{ 30{
26 Q_UNUSED(pe); 31 Q_UNUSED(pe);
27 32
28 int instid=data->getCurrentInstrumentID(); 33 int instid=data->getCurrentInstrumentID();
29 inst=data->getInstrument(instid); 34 inst=data->getInstrument(instid);
30 //qDebug("inst %d is %s",instid,inst.instName().data()); 35 //odebug << "inst " << instid << " is " << inst.instName().data() << "" << oendl;
31 36
32 QRect mysize=rect(); 37 QRect mysize=rect();
33 38
34 xmargin=(int)(mysize.width()*0.05); 39 xmargin=(int)(mysize.width()*0.05);
35 xmin=2*xmargin; 40 xmin=2*xmargin;
36 xmax=mysize.width()-xmargin; 41 xmax=mysize.width()-xmargin;
37 xwidth=xmax-xmin; 42 xwidth=xmax-xmin;
38 43
39 ymargin=(int)(mysize.height()*0.1); 44 ymargin=(int)(mysize.height()*0.1);
40 ymin=ymargin; 45 ymin=ymargin;
41 ymax=mysize.height()-2*ymargin; 46 ymax=mysize.height()-2*ymargin;
42 yheight=ymax-ymin; 47 yheight=ymax-ymin;
@@ -134,35 +139,35 @@ void Graph::FretBoard::paintScale(QPainter* p)
134 int y=(int)(stringdist*s)+ymin; 139 int y=(int)(stringdist*s)+ymin;
135 int stingid=inst.noOfStrings()-(s+1); 140 int stingid=inst.noOfStrings()-(s+1);
136 for(int f=0;f<=inst.noOfFrets();f++) 141 for(int f=0;f<=inst.noOfFrets();f++)
137 { 142 {
138 int note=inst.string(stingid)+f; 143 int note=inst.string(stingid)+f;
139 if(scale.noteInScale(data->getCurrentBaseNote(),note)) 144 if(scale.noteInScale(data->getCurrentBaseNote(),note))
140 { 145 {
141 int x=(int)(fretdist*f)+xmin; 146 int x=(int)(fretdist*f)+xmin;
142 147
143 //no more than six octaves can be visualised (there is a zero octave) 148 //no more than six octaves can be visualised (there is a zero octave)
144 int octave=Note::octaveOfBaseNote(data->getCurrentBaseNote(),note)-baseoctave; 149 int octave=Note::octaveOfBaseNote(data->getCurrentBaseNote(),note)-baseoctave;
145 if(octave<0) 150 if(octave<0)
146 qDebug("%d,%d",octave,baseoctave); 151 odebug << "" << octave << "," << baseoctave << "" << oendl;
147 if(octave>5) 152 if(octave>5)
148 { 153 {
149 qDebug("octave out of range"); 154 odebug << "octave out of range" << oendl;
150 octave=5; 155 octave=5;
151 } 156 }
152 157
153 p->setPen(QColor(255,0,0)); 158 p->setPen(QColor(255,0,0));
154 int c= ( (note-12*baseoctave) - (12*octave+data->getCurrentBaseNote()) )*15; 159 int c= ( (note-12*baseoctave) - (12*octave+data->getCurrentBaseNote()) )*15;
155 if(c<0 || c>255) 160 if(c<0 || c>255)
156 qDebug("%d = %d - ( %d + %d)",c,note,12*octave,data->getCurrentBaseNote()); 161 odebug << "" << c << " = " << note << " - ( " << 12*octave << " + " << data->getCurrentBaseNote() << ")" << oendl;
157 QColor dotcolor(255,255,255); 162 QColor dotcolor(255,255,255);
158 163
159 if(octave==0) 164 if(octave==0)
160 dotcolor=QColor(c,c,255); 165 dotcolor=QColor(c,c,255);
161 else if(octave==1) 166 else if(octave==1)
162 dotcolor=QColor(c,255,c); 167 dotcolor=QColor(c,255,c);
163 else if(octave==2) 168 else if(octave==2)
164 dotcolor=QColor(255,c,c); 169 dotcolor=QColor(255,c,c);
165 else if(octave==3) 170 else if(octave==3)
166 dotcolor=QColor(255,255,c); 171 dotcolor=QColor(255,255,c);
167 else if(octave==4) 172 else if(octave==4)
168 dotcolor=QColor(255,c,255); 173 dotcolor=QColor(255,c,255);
diff --git a/noncore/multimedia/tonleiter/tonleiter.pro b/noncore/multimedia/tonleiter/tonleiter.pro
index 4bd1bc2..4be3bef 100644
--- a/noncore/multimedia/tonleiter/tonleiter.pro
+++ b/noncore/multimedia/tonleiter/tonleiter.pro
@@ -1,13 +1,11 @@
1TEMPLATE = app 1TEMPLATE = app
2#CONFIG = qt warn_on
3CONFIG = qt warn_on 2CONFIG = qt warn_on
4HEADERS = mainwidget.h tonleiterdata.h tonleiterdatahelper.h fretboard.h menuwidget.h editinst.h editstringwidget.h editscale.h pianoscale.h 3HEADERS = mainwidget.h tonleiterdata.h tonleiterdatahelper.h fretboard.h menuwidget.h editinst.h editstringwidget.h editscale.h pianoscale.h
5SOURCES = mainwidget.cpp tonleiterdata.cpp tonleiterdatahelper.cpp fretboard.cpp menuwidget.cpp main.cpp editinst.cpp editstringwidget.cpp editscale.cpp pianoscale.cpp 4SOURCES = mainwidget.cpp tonleiterdata.cpp tonleiterdatahelper.cpp fretboard.cpp menuwidget.cpp main.cpp editinst.cpp editstringwidget.cpp editscale.cpp pianoscale.cpp
6INCLUDEPATH += $(OPIEDIR)/include 5INCLUDEPATH += $(OPIEDIR)/include
7DEPENDPATH += $(OPIEDIR)/include 6DEPENDPATH += $(OPIEDIR)/include
8LIBS += -lqpe 7LIBS += -lqpe -lopiecore2
9INTERFACES =
10TARGET = tonleiter 8TARGET = tonleiter
11DESTDIR = $(OPIEDIR)/bin 9DESTDIR = $(OPIEDIR)/bin
12#TMAKE_CXXFLAGS += -DQT_QWS_VERCEL_IDR -DQWS -fno-exceptions -fno-rtti 10
13include ( $(OPIEDIR)/include.pro ) 11include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/multimedia/tonleiter/tonleiterdata.cpp b/noncore/multimedia/tonleiter/tonleiterdata.cpp
index 33b3c49..564b7f0 100644
--- a/noncore/multimedia/tonleiter/tonleiterdata.cpp
+++ b/noncore/multimedia/tonleiter/tonleiterdata.cpp
@@ -1,18 +1,19 @@
1#include "tonleiterdata.h" 1#include "tonleiterdata.h"
2
3#include <qpe/config.h>
4
5using namespace Data; 2using namespace Data;
6 3
4/* OPIE */
5#include <opie2/odebug.h>
6#include <qpe/config.h>
7using namespace Opie::Core;
7 8
8TonleiterData::TonleiterData(QObject* parent) 9TonleiterData::TonleiterData(QObject* parent)
9:QObject(parent) 10:QObject(parent)
10{ 11{
11 drawnames=true; 12 drawnames=true;
12 loadData(); 13 loadData();
13} 14}
14//**************************************************************************** 15//****************************************************************************
15TonleiterData::~TonleiterData() 16TonleiterData::~TonleiterData()
16{ 17{
17 saveData(); 18 saveData();
18} 19}
@@ -143,47 +144,47 @@ void TonleiterData::saveData()
143//**************************************************************************** 144//****************************************************************************
144int TonleiterData::noOfInstruments() 145int TonleiterData::noOfInstruments()
145{ 146{
146 return (int)instruments.count(); 147 return (int)instruments.count();
147} 148}
148//**************************************************************************** 149//****************************************************************************
149Instrument TonleiterData::getInstrument(int id) 150Instrument TonleiterData::getInstrument(int id)
150{ 151{
151 if(id>=0 && id<noOfInstruments()) 152 if(id>=0 && id<noOfInstruments())
152 return instruments[id]; 153 return instruments[id];
153 else 154 else
154 { 155 {
155 qDebug("undefined insrtument %d of %d",id,instruments.count()); 156 odebug << "undefined insrtument " << id << " of " << instruments.count() << "" << oendl;
156 return Instrument(); 157 return Instrument();
157 } 158 }
158 159
159} 160}
160//**************************************************************************** 161//****************************************************************************
161int TonleiterData::getCurrentInstrumentID() 162int TonleiterData::getCurrentInstrumentID()
162{ 163{
163 return currentInstrumentID; 164 return currentInstrumentID;
164} 165}
165//**************************************************************************** 166//****************************************************************************
166int TonleiterData::noOfScales() 167int TonleiterData::noOfScales()
167{ 168{
168 return (int)scales.count(); 169 return (int)scales.count();
169} 170}
170//**************************************************************************** 171//****************************************************************************
171Scale TonleiterData::getScale(int id) 172Scale TonleiterData::getScale(int id)
172{ 173{
173 if(id>=0 && id<noOfScales()) 174 if(id>=0 && id<noOfScales())
174 return scales[id]; 175 return scales[id];
175 else 176 else
176 { 177 {
177 qDebug("Undefined scale"); 178 odebug << "Undefined scale" << oendl;
178 return Scale(); 179 return Scale();
179 } 180 }
180} 181}
181//**************************************************************************** 182//****************************************************************************
182int TonleiterData::getCurrentScaleID() 183int TonleiterData::getCurrentScaleID()
183{ 184{
184 return currentScaleID; 185 return currentScaleID;
185} 186}
186//**************************************************************************** 187//****************************************************************************
187int TonleiterData::getCurrentBaseNote() 188int TonleiterData::getCurrentBaseNote()
188{ 189{
189 return currentNote; 190 return currentNote;
diff --git a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp
index d904a71..285d2c1 100644
--- a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp
+++ b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp
@@ -25,25 +25,25 @@ int Note::getNoteFromName(QString name,int octave)
25 { 25 {
26 notevalue=a; 26 notevalue=a;
27 break; 27 break;
28 } 28 }
29 } 29 }
30 return notevalue+12*octave; 30 return notevalue+12*octave;
31} 31}
32//**************************************************************************** 32//****************************************************************************
33int Note::octaveOfBaseNote(int base,int note) 33int Note::octaveOfBaseNote(int base,int note)
34{ 34{
35 int normnote = (note>=base) ? note-base : (12-base)+note; 35 int normnote = (note>=base) ? note-base : (12-base)+note;
36 int octave=getOctaveOfNote(normnote); 36 int octave=getOctaveOfNote(normnote);
37 //qDebug("note %d of %d base is norm %d -> ocatve %d",note,base,normnote,octave); 37 //odebug << "note " << note << " of " << base << " base is norm " << normnote << " -> ocatve " << octave << "" << oendl;
38 return octave; 38 return octave;
39} 39}
40//**************************************************************************** 40//****************************************************************************
41//**************************************************************************** 41//****************************************************************************
42Instrument::Instrument() 42Instrument::Instrument()
43{ 43{
44 name="UNDEFINED"; 44 name="UNDEFINED";
45 frets=0; 45 frets=0;
46} 46}
47//**************************************************************************** 47//****************************************************************************
48Instrument::Instrument(QString name,int frets,QValueList<int> strings) 48Instrument::Instrument(QString name,int frets,QValueList<int> strings)
49:name(name),frets(frets),strings(strings) 49:name(name),frets(frets),strings(strings)
@@ -122,23 +122,23 @@ QString Scale::scaleName()
122{ 122{
123 return name; 123 return name;
124} 124}
125//**************************************************************************** 125//****************************************************************************
126bool Scale::noteInScale(int base,int note) 126bool Scale::noteInScale(int base,int note)
127{ 127{
128 int octave=Note::getOctaveOfNote(note); 128 int octave=Note::getOctaveOfNote(note);
129 note-=12*octave; 129 note-=12*octave;
130 int normnote = (note>=base) ? note-base : (12-base)+note; 130 int normnote = (note>=base) ? note-base : (12-base)+note;
131 131
132 if(halftones.contains(normnote)>0) 132 if(halftones.contains(normnote)>0)
133 { 133 {
134 //qDebug("OK : base : %d, note %d -> norm %d",base,note,normnote); 134 //odebug << "OK : base : " << base << ", note " << note << " -> norm " << normnote << "" << oendl;
135 return true; 135 return true;
136 } 136 }
137 else 137 else
138 { 138 {
139 //qDebug("BAD : base : %d, note %d -> norm %d",base,note,normnote); 139 //odebug << "BAD : base : " << base << ", note " << note << " -> norm " << normnote << "" << oendl;
140 return false; 140 return false;
141 } 141 }
142} 142}
143//**************************************************************************** 143//****************************************************************************
144//**************************************************************************** 144//****************************************************************************