28 files changed, 268 insertions, 243 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 @@ -120,33 +120,33 @@ void AudioWidget::resizeEvent( QResizeEvent *e ) { } void AudioWidget::sliderPressed() { audioSliderBeingMoved = TRUE; } void AudioWidget::sliderReleased() { audioSliderBeingMoved = FALSE; if ( slider.width() == 0 ) return; long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); mediaPlayerState.setPosition( val ); } void AudioWidget::setPosition( long i ) { - // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); + // odebug << "<<<<<<<<<<<<<<<<<<<<<<<<set position " << i << "" << oendl; updateSlider( i, mediaPlayerState.length() ); } void AudioWidget::setLength( long max ) { updateSlider( mediaPlayerState.position(), max ); } void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { if ( mediaType == MediaPlayerState::Audio ) { // startTimer( 150 ); QPEApplication::showWidget( this ); return; } @@ -174,45 +174,45 @@ void AudioWidget::loadSkin() // Config cofg("qpe"); // cofg.setGroup("Appearance"); // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); time.setFocusPolicy( QWidget::NoFocus ); time.setAlignment( Qt::AlignCenter ); // time.setFrame(FALSE); // changeTextColor( &time ); resizeEvent( 0 ); } void AudioWidget::setSeekable( bool isSeekable ) { if ( !isSeekable ) { - qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); + odebug << "<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>" << oendl; if( !slider.isHidden()) { slider.hide(); } disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); } else { // this stops the slider from being moved, thus // does not stop stream when it reaches the end slider.show(); - qDebug( " CONNECT SET POSTION " ); + odebug << " CONNECT SET POSTION " << oendl; connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); } } static QString timeAsString( long length ) { int minutes = length / 60; int seconds = length % 60; return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); } void AudioWidget::updateSlider( long i, long max ) { @@ -258,33 +258,33 @@ void AudioWidget::stopSkip() { void AudioWidget::timerEvent( QTimerEvent * ) { if ( skipDirection == +1 ) { mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); } else if ( skipDirection == -1 ) { mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); } } void AudioWidget::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_Home: break; case Key_F9: //activity hide(); - // qDebug("Audio F9"); + // odebug << "Audio F9" << oendl; e->accept(); break; case Key_F10: //contacts break; case Key_F11: //menu mediaPlayerState.toggleBlank(); e->accept(); break; case Key_F12: //home break; case Key_F13: //mail mediaPlayerState.toggleBlank(); e->accept(); break; case Key_Space: { e->accept(); 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 @@ -93,36 +93,36 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) ts << "audio.out_size_audio_buf:8096\n"; ts << "audio.out_size_zero_buf:1024\n"; ts << "audio.passthrough_offset:0\n"; f.close(); } if ( initMode == InitializeImmediately ) { initialize(); m_initialized = true; } else start(); } void Lib::run() { - qDebug( "Lib::run() started" ); + odebug << "Lib::run() started" << oendl; initialize(); m_initialized = true; - qDebug( "Lib::run() finished" ); + odebug << "Lib::run() finished" << oendl; } void Lib::initialize() { m_duringInitialization = true; m_xine = xine_new( ); QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; xine_config_load( m_xine, QFile::encodeName( configPath ) ); xine_init( m_xine ); // allocate oss for sound // and fb for framebuffer m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); @@ -202,33 +202,33 @@ int Lib::play( const QString& fileName, int startPos, int start_time ) { QString str = fileName.stripWhiteSpace(); //m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); //m_queue = xine_event_new_queue (m_stream); //xine_event_create_listener_thread (m_queue, xine_event_handler, this); if ( !xine_open( m_stream, str.utf8().data() ) ) { return 0; } return xine_play( m_stream, startPos, start_time); } void Lib::stop() { assert( m_initialized ); - qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); + odebug << "<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>" << oendl; xine_stop( m_stream ); } void Lib::pause( bool toggle ) { assert( m_initialized ); xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); } int Lib::speed() const { assert( m_initialized ); return xine_get_param ( m_stream, XINE_PARAM_SPEED ); } void Lib::setSpeed( int speed ) { @@ -314,35 +314,35 @@ QString Lib::metaInfo( int number) const { assert( m_initialized ); return xine_get_meta_info( m_stream, number ); } int Lib::error() const { assert( m_initialized ); return xine_get_error( m_stream ); }; void Lib::ensureInitialized() { if ( m_initialized ) return; - qDebug( "waiting for initialization thread to finish" ); + odebug << "waiting for initialization thread to finish" << oendl; wait(); - qDebug( "initialization thread finished!" ); + odebug << "initialization thread finished!" << oendl; } void Lib::setWidget( XineVideoWidget *widget ) { m_wid = widget; resize ( m_wid-> size ( ) ); ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); m_wid->repaint(); } void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) { assert( sendType == ThreadUtil::Channel::OneWay ); handleXineEvent( msg->type() ); delete msg; } @@ -409,24 +409,24 @@ bool Lib::isScaling() const { return ::null_is_scaling( m_videoOutput ); } void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { ( (Lib*)user_data)->handleXineEvent( t ); } void Lib::xine_display_frame( void* user_data, uint8_t *frame, int width, int height, int bytes ) { ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); } void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { assert( m_initialized ); if ( !m_video ) { - qWarning("not showing video now"); + owarn << "not showing video now" << oendl; return; } assert( m_wid ); m_wid-> setVideoFrame ( frame, width, height, bytes ); } 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 @@ -139,33 +139,33 @@ void MediaPlayer::prev() { } void MediaPlayer::next() { if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist if ( playList.next() ) { play(); } else if ( mediaPlayerState.isLooping() ) { if ( playList.first() ) { play(); } } else { mediaPlayerState.setList(); } } else { //if playing from file list, let's just stop - qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); + odebug << "<<<<<<<<<<<<<<<<<stop for filelists" << oendl; mediaPlayerState.setPlaying(false); mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); if(l) mediaPlayerState.setLooping(l); if(r) mediaPlayerState.setShuffled(r); } qApp->processEvents(); } void MediaPlayer::startDecreasingVolume() { volumeDirection = -1; startTimer( 100 ); volControl->decVol(2); } @@ -272,77 +272,77 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); } else { p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); } } } } void MediaPlayer::blank( bool b ) { fd=open("/dev/fb0",O_RDWR); #ifdef QT_QWS_SL5XXX fl= open( "/dev/fl", O_RDWR ); #endif if (fd != -1) { if ( b ) { - qDebug("do blanking"); + odebug << "do blanking" << oendl; #ifdef QT_QWS_SL5XXX ioctl( fd, FBIOBLANK, 1 ); if(fl !=-1) { ioctl( fl, 2 ); ::close(fl); } #else ioctl( fd, FBIOBLANK, 3 ); #endif isBlanked = TRUE; } else { - qDebug("do unblanking"); + odebug << "do unblanking" << oendl; ioctl( fd, FBIOBLANK, 0); #ifdef QT_QWS_SL5XXX if(fl != -1) { ioctl( fl, 1); ::close(fl); } #endif isBlanked = FALSE; } close( fd ); } else { - qDebug("<< /dev/fb0 could not be opened >>"); + odebug << "<< /dev/fb0 could not be opened >>" << oendl; } } void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_Home: break; case Key_F9: //activity break; case Key_F10: //contacts break; case Key_F11: //menu break; case Key_F12: //home - qDebug("Blank here"); + odebug << "Blank here" << oendl; // mediaPlayerState->toggleBlank(); break; case Key_F13: //mail - qDebug("Blank here"); + odebug << "Blank here" << oendl; // mediaPlayerState->toggleBlank(); break; } } void MediaPlayer::cleanUp() {// this happens on closing Config cfg( "OpiePlayer" ); mediaPlayerState.writeConfig( cfg ); playList.writeDefaultPlaylist( ); // QPEApplication::grabKeyboard(); // QPEApplication::ungrabKeyboard(); } void MediaPlayer::recreateAudioAndVideoWidgets() const { 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 @@ -24,76 +24,76 @@ -_. . . )=. = General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "om3u.h" //extern PlayListWidget *playList; Om3u::Om3u( const QString &filePath, int mode) : QStringList (){ -qDebug("<<<<<<<new m3u "+filePath); +odebug << "<<<<<<<new m3u "+filePath << oendl; f.setName(filePath); f.open(mode); } Om3u::~Om3u(){} void Om3u::readM3u() { -// qDebug("<<<<<<reading m3u "+f.name()); +// odebug << "<<<<<<reading m3u "+f.name() << oendl; QTextStream t(&f); t.setEncoding(QTextStream::UnicodeUTF8); QString s; while ( !t.atEnd() ) { s=t.readLine(); -// qDebug(s); +// odebug << s << oendl; if( s.find( "#", 0, TRUE) == -1 ) { if( s.left(2) == "E:" || s.left(2) == "P:" ) { s = s.right( s.length() -2 ); QFileInfo f( s ); QString name = f.baseName(); name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); s=s.replace( QRegExp( "\\" ), "/" ); append(s); -// qDebug(s); +// odebug << s << oendl; } else { // is url QString name; name = s; append(name); } } } } void Om3u::readPls() { //it's a pls file QTextStream t( &f ); t.setEncoding(QTextStream::UnicodeUTF8); QString s; while ( !t.atEnd() ) { s = t.readLine(); if( s.left(4) == "File" ) { s = s.right( s.length() - s.find("=",0,true)-1 ); s = s.stripWhiteSpace(); s.replace( QRegExp( "%20" )," "); -// qDebug( "adding " + s + " to playlist" ); +// odebug << "adding " + s + " to playlist" << oendl; // numberofentries=2 // File1=http // Title // Length // Version // File2=http s = s.replace( QRegExp( "\\" ), "/" ); QFileInfo f( s ); QString name = f.baseName(); if( name.left( 4 ) == "http" ) { name = s.right( s.length() - 7); } else { name = s; } name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); if( s.at( s.length() - 4) == '.') // if this is probably a file @@ -101,49 +101,49 @@ void Om3u::readPls() { //it's a pls file else { //if its a url // if( name.right( 1 ).find( '/' ) == -1) { // s += "/"; // } append(s); } } } } void Om3u::write() { //writes list to m3u file QString list; QTextStream t(&f); t.setEncoding(QTextStream::UnicodeUTF8); if(count()>0) { for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { -// qDebug(*it); +// odebug << *it << oendl; t << *it << "\n"; } } // f.close(); } void Om3u::add(const QString &filePath) { //adds to m3u file append(filePath); } void Om3u::remove(const QString &filePath) { //removes from m3u list QString list, currentFile; if(count()>0) { for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { currentFile=*it; - // qDebug(*it); + // odebug << *it << oendl; if( filePath != currentFile) list += currentFile+"\n"; } f.writeBlock( list, list.length() ); } } void Om3u::deleteFile(const QString &/*filePath*/) {//deletes m3u file f.close(); f.remove(); } void Om3u::close() { //closes m3u file f.close(); 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 @@ -31,54 +31,54 @@ public: setPixmap( 0, f->pixmap() ); } ~PlayListSelectionItem() { }; const DocLnk *file() const { return fl; } private: const DocLnk *fl; }; PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) : QListView( parent, name ) { -// qDebug("starting playlistselector"); +// odebug << "starting playlistselector" << oendl; // #ifdef USE_PLAYLIST_BACKGROUND // setStaticBackground( TRUE ); // setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) ); // setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); // #endif // addColumn("Title",236); // setAllColumnsShowFocus( TRUE ); addColumn( tr( "Playlist Selection" ) ); header()->hide(); setSorting( -1, FALSE ); } PlayListSelection::~PlayListSelection() { } // #ifdef USE_PLAYLIST_BACKGROUND void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { -// qDebug("drawBackground"); +// odebug << "drawBackground" << oendl; p->fillRect( r, QBrush( white ) ); // QImage logo = Resource::loadImage( "launcher/opielogo" ); // if ( !logo.isNull() ) // p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); } // #endif void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { if ( event->state() == QMouseEvent::LeftButton ) { QListViewItem *currentItem = selectedItem(); QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); if ( currentItem && currentItem->itemAbove() == itemUnder ) moveSelectedUp(); else if ( currentItem && currentItem->itemBelow() == itemUnder ) moveSelectedDown(); @@ -171,36 +171,36 @@ bool PlayListSelection::last() { return FALSE; ensureItemVisible( selectedItem() ); return TRUE; } void PlayListSelection::unSelect() { //QListViewItem *item = selectedItem(); setSelected( currentItem(), FALSE); } void PlayListSelection::writeCurrent( Config& cfg ) { cfg.setGroup("PlayList"); QListViewItem *item = selectedItem(); if ( item ) cfg.writeEntry("current", item->text(0) ); - qDebug(item->text(0)); + odebug << item->text(0) << oendl; } void PlayListSelection::setSelectedItem(const QString &strk ) { unSelect(); QListViewItemIterator it( this ); for ( ; it.current(); ++it ) { -// qDebug( it.current()->text(0)); +// odebug << it.current()->text(0) << oendl; if( strk == it.current()->text(0)) { -// qDebug( "We have a match "+strk); +// odebug << "We have a match "+strk << oendl; setSelected( it.current(), TRUE); ensureItemVisible( it.current() ); return; } } // setSelected( item, TRUE ); // ensureItemVisible( selectedItem() ); } 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 @@ -169,37 +169,37 @@ PlayListWidget::~PlayListWidget() { void PlayListWidget::initializeStates() { d->tbPlay->setOn( mediaPlayerState->isPlaying() ); d->tbLoop->setOn( mediaPlayerState->isLooping() ); d->tbShuffle->setOn( mediaPlayerState->isShuffled() ); d->playListFrame->show(); } void PlayListWidget::writeDefaultPlaylist() { Config config( "OpiePlayer" ); config.setGroup( "PlayList" ); QString filename=QPEApplication::documentDir() + "/default.m3u"; QString currentString = config.readEntry( "CurrentPlaylist", filename); if( currentString == filename) { Om3u *m3uList; - // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); + // odebug << "<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>" << oendl; if( d->selectedFiles->first() ) { m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); do { - // qDebug(d->selectedFiles->current()->file()); + // odebug << d->selectedFiles->current()->file() << oendl; m3uList->add( d->selectedFiles->current()->file() ); } while ( d->selectedFiles->next() ); m3uList->write(); m3uList->close(); delete m3uList; } } } void PlayListWidget::addToSelection( const DocLnk& lnk ) { d->setDocumentUsed = FALSE; if( QFileInfo( lnk.file() ).exists() || lnk.file().left(4) == "http" ) { @@ -312,33 +312,33 @@ void PlayListWidget::addAllVideoToList() { QListViewItemIterator videoIt( videoView ); DocLnk lnk; QString filename; for ( ; videoIt.current(); ++videoIt ) { filename = videoIt.current()->text(3); lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); } tabWidget->setCurrentPage(0); writeCurrentM3u(); d->selectedFiles->first(); } void PlayListWidget::setDocument( const QString& fileref ) { - // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); + // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl; fromSetDocument = TRUE; QFileInfo fileInfo(fileref); if ( !fileInfo.exists() ) { QMessageBox::warning( this, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); return; } clearList(); QString extension = fileInfo.extension(false); if( extension.find( "m3u", 0, false) != -1 || extension.find( "pls", 0, false) != -1 ) { readListFromFile( fileref ); } else { @@ -388,33 +388,33 @@ bool PlayListWidget::prev() { } return TRUE; } else { if ( !d->selectedFiles->prev() ) { if ( mediaPlayerState->isLooping() ) { return d->selectedFiles->last(); } else { return FALSE; } } return TRUE; } } bool PlayListWidget::next() { -//qDebug("<<<<<<<<<<<<next()"); +//odebug << "<<<<<<<<<<<<next()" << oendl; if ( mediaPlayerState->isShuffled() ) { return prev(); } else { if ( !d->selectedFiles->next() ) { if ( mediaPlayerState->isLooping() ) { return d->selectedFiles->first(); } else { return FALSE; } } return TRUE; } } bool PlayListWidget::first() { @@ -599,33 +599,33 @@ void PlayListWidget::playSelected() { bool PlayListWidget::inFileListMode() const { TabType tab = currentTab(); return tab == AudioFiles || tab == VideoFiles; } void PlayListWidget::openURL() { // http://66.28.164.33:2080 // http://somafm.com/star0242.m3u QString filename, name; InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { filename = fileDlg->text(); - qDebug( "Selected filename is " + filename ); + odebug << "Selected filename is " + filename << oendl; // Om3u *m3uList; DocLnk lnk; Config cfg( "OpiePlayer" ); cfg.setGroup("PlayList"); if(filename.left(4) == "http") { QString m3uFile, m3uFilePath; if(filename.find(":",8,TRUE) != -1) { //found a port m3uFile = filename.left( filename.find( ":",8,TRUE)); m3uFile = m3uFile.right( 7); } else if(filename.left(4) == "http"){ m3uFile=filename; m3uFile = m3uFile.right( m3uFile.length() - 7); } else{ m3uFile=filename; } @@ -675,64 +675,64 @@ void PlayListWidget::openFile() { all += video; types.insert("All Media Files", all ); types.insert("Audio", audio ); types.insert("Video", video ); QString str = OFileDialog::getOpenFileName( 1, cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", types, 0 ); if(str.left(2) == "//") { str=str.right(str.length()-1); } cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() ); if( !str.isEmpty() ) { - qDebug( "Selected filename is " + str ); + odebug << "Selected filename is " + str << oendl; filename = str; DocLnk lnk; if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { readListFromFile( filename ); } else { lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk ); writeCurrentM3u(); d->selectedFiles->setSelectedItem( lnk.name() ); } } } void PlayListWidget::readListFromFile( const QString &filename ) { - qDebug( "read list filename " + filename ); + odebug << "read list filename " + filename << oendl; QFileInfo fi(filename); Om3u *m3uList; QString s, name; m3uList = new Om3u( filename, IO_ReadOnly ); if(fi.extension(false).find("m3u",0,false) != -1 ) m3uList->readM3u(); else if(fi.extension(false).find("pls",0,false) != -1 ) m3uList->readPls(); DocLnk lnk; for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { s = *it; - // qDebug(s); + // odebug << s << oendl; if(s.left(4)=="http") { lnk.setName( s ); //sets file name lnk.setIcon("opieplayer2/musicfile"); lnk.setFile( s ); //sets file name } else { //is file lnk.setName( QFileInfo(s).baseName()); if(s.left(1) != "/") { lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); } else { lnk.setFile( s); } } d->selectedFiles->addToSelection( lnk ); } @@ -740,47 +740,47 @@ void PlayListWidget::readListFromFile( const QString &filename ) { config.setGroup( "PlayList" ); config.writeEntry("CurrentPlaylist",filename); config.write(); currentPlayList=filename; m3uList->close(); delete m3uList; d->selectedFiles->setSelectedItem( s); setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); } // writes current playlist to current m3u file */ void PlayListWidget::writeCurrentM3u() { - qDebug("writing to current m3u"); + odebug << "writing to current m3u" << oendl; Config cfg( "OpiePlayer" ); cfg.setGroup("PlayList"); QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); Om3u *m3uList; m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); if( d->selectedFiles->first()) { do { - // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); + // odebug << "add writeCurrentM3u " +d->selectedFiles->current()->file() << oendl; m3uList->add( d->selectedFiles->current()->file() ); } while ( d->selectedFiles->next() ); - // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); + // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl; m3uList->write(); m3uList->close(); } delete m3uList; } /* writes current playlist to m3u file */ void PlayListWidget::writem3u() { //InputDilog *fileDlg; //fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); //fileDlg->exec(); Config cfg( "OpiePlayer" ); cfg.setGroup("Dialog"); @@ -799,71 +799,71 @@ void PlayListWidget::writem3u() { types.insert("Audio", audio ); types.insert("Video", video ); QString str = OFileDialog::getOpenFileName( 1, cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", types, 0 ); if(str.left(2) == "//") str=str.right(str.length()-1); cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); QString name, filename, list; Om3u *m3uList; if( !str.isEmpty() ) { name = str; // name = fileDlg->text(); -// qDebug( filename ); +// odebug << filename << oendl; if( name.find("/",0,true) != -1) {// assume they specify a file path filename = name; name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); } else //otherwise dump it somewhere noticable filename = QPEApplication::documentDir() + "/" + name; if( filename.right( 3 ) != "m3u" ) //needs filename extension filename += ".m3u"; if( d->selectedFiles->first()) { //ramble through playlist view m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate); do { m3uList->add( d->selectedFiles->current()->file()); } while ( d->selectedFiles->next() ); - // qDebug( list ); + // odebug << list << oendl; m3uList->write(); m3uList->close(); delete m3uList; //delete fileDlg; DocLnk lnk; lnk.setFile( filename); lnk.setIcon("opieplayer2/playlist2"); lnk.setName( name); //sets file name - // qDebug(filename); + // odebug << filename << oendl; Config config( "OpiePlayer" ); config.setGroup( "PlayList" ); config.writeEntry("CurrentPlaylist",filename); currentPlayList=filename; if(!lnk.writeLink()) { - qDebug("Writing doclink did not work"); + odebug << "Writing doclink did not work" << oendl; } setCaption(tr("OpiePlayer: ") + name); } } } void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_F9: //activity // if(audioUI->isHidden()) // audioUI->showMaximized(); break; case Key_F10: //contacts // if( videoUI->isHidden()) @@ -871,93 +871,93 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { break; case Key_F11: //menu break; case Key_F12: //home // doBlank(); break; case Key_F13: //mail // doUnblank(); break; case Key_Q: //add to playlist addSelected(); break; case Key_R: //remove from playlist removeSelected(); break; // case Key_P: //play - // qDebug("Play"); + // odebug << "Play" << oendl; // playSelected(); // break; case Key_Space: // playSelected(); puh break; case Key_1: tabWidget->setCurrentPage( 0 ); break; case Key_2: tabWidget->setCurrentPage( 1 ); break; case Key_3: tabWidget->setCurrentPage( 2 ); break; case Key_4: tabWidget->setCurrentPage( 3 ); break; case Key_Down: if ( !d->selectedFiles->next() ) d->selectedFiles->first(); break; case Key_Up: if ( !d->selectedFiles->prev() ) // d->selectedFiles->last(); break; } } void PlayListWidget::pmViewActivated(int index) { -// qDebug("%d", index); +// odebug << "" << index << "" << oendl; switch(index) { case -16: { mediaPlayerState->toggleFullscreen(); bool b=mediaPlayerState->isFullscreen(); pmView->setItemChecked( index, b); Config cfg( "OpiePlayer" ); cfg.writeEntry( "FullScreen", b ); } break; }; } void PlayListWidget::populateSkinsMenu() { int item = 0; defaultSkinIndex = 0; QString skinName; Config cfg( "OpiePlayer" ); cfg.setGroup("Options" ); QString skin = cfg.readEntry( "Skin", "default" ); QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); skinsDir.setFilter( QDir::Dirs ); skinsDir.setSorting(QDir::Name ); const QFileInfoList *skinslist = skinsDir.entryInfoList(); QFileInfoListIterator it( *skinslist ); QFileInfo *fi; while ( ( fi = it.current() ) ) { skinName = fi->fileName(); -// qDebug( fi->fileName() ); +// odebug << fi->fileName() << oendl; if( skinName != "." && skinName != ".." && skinName !="CVS" ) { item = skinsMenu->insertItem( fi->fileName() ) ; } if( skinName == "default" ) { defaultSkinIndex = item; } if( skinName == skin ) { skinsMenu->setItemChecked( item, TRUE ); } ++it; } } void PlayListWidget::skinsMenuActivated( int item ) { for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { skinsMenu->setItemChecked( i, FALSE ); @@ -987,33 +987,33 @@ PlayListWidget::TabType PlayListWidget::currentTab() const PlayListWidget::Entry PlayListWidget::currentEntry() const { if ( currentTab() == CurrentPlayList ) { const DocLnk *lnk = current(); return Entry( lnk->name(), lnk->file() ); } return Entry( currentFileListPathName() ); } QString PlayListWidget::currentFileListPathName() const { return currentFileListView->currentItem()->text( 3 ); } void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { - qDebug("qcop message "+msg ); + odebug << "qcop message "+msg << oendl; QDataStream stream ( data, IO_ReadOnly ); if ( msg == "play()" ) { //plays current selection btnPlay( true); } else if ( msg == "stop()" ) { mediaPlayerState->setPlaying( false); } else if ( msg == "togglePause()" ) { mediaPlayerState->togglePaused(); } else if ( msg == "next()" ) { //select next in list mediaPlayerState->setNext(); } else if ( msg == "prev()" ) { //select previous in list mediaPlayerState->setPrev(); } else if ( msg == "toggleLooping()" ) { //loop or not loop mediaPlayerState->toggleLooping(); } else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled mediaPlayerState->toggleShuffled(); } else if ( msg == "volUp()" ) { //volume more 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 @@ -170,24 +170,24 @@ PlayListWidgetGui::PlayListWidgetGui(QWidget* parent, const char* name ) } PlayListWidgetGui::~PlayListWidgetGui() { } void PlayListWidgetGui::setView( char view ) { if ( view == 'l' ) showMaximized(); else hide(); } void PlayListWidgetGui::setActiveWindow() { - // qDebug("SETTING active window"); + // odebug << "SETTING active window" << oendl; // When we get raised we need to ensure that it switches views MediaPlayerState::DisplayType origDisplayType = mediaPlayerState->displayType(); mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); // invalidate mediaPlayerState->setDisplayType( origDisplayType ); // now switch back } 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 @@ -165,37 +165,37 @@ QImage Skin::loadImage( const QString &fileName ) SkinCache::SkinCache() { // let's say we cache two skins (audio+video) at maximum m_cache.setMaxCost( 2 ); // ... and one background pixmap m_backgroundPixmapCache.setMaxCost( 1 ); } SkinData *SkinCache::lookupAndTake( const QString &skinPath, const QString &fileNameInfix ) { QString key = skinPath + fileNameInfix; SkinData *data = m_cache.take( key ); if ( !data ) data = new SkinData; else - qDebug( "SkinCache: hit" ); + odebug << "SkinCache: hit" << oendl; QPixmap *bgPixmap = m_backgroundPixmapCache.find( skinPath ); if ( bgPixmap ) { - qDebug( "SkinCache: hit on bgpixmap" ); + odebug << "SkinCache: hit on bgpixmap" << oendl; data->backgroundPixmap = *bgPixmap; } else data->backgroundPixmap = QPixmap(); return data; } void SkinCache::store( const QString &skinPath, const QString &fileNameInfix, SkinData *data ) { QPixmap *backgroundPixmap = new QPixmap( data->backgroundPixmap ); data->backgroundPixmap = QPixmap(); QString key = skinPath + fileNameInfix; @@ -205,118 +205,118 @@ void SkinCache::store( const QString &skinPath, const QString &fileNameInfix, Sk if ( m_backgroundPixmapCache.find( skinPath, false /*ref*/ ) != 0 || !m_backgroundPixmapCache.insert( skinPath, backgroundPixmap ) ) delete backgroundPixmap; } SkinLoader::IncrementalLoader::IncrementalLoader( const Info &info ) : m_skin( info.skinName, info.fileNameInfix ), m_info( info ) { m_currentState = LoadBackgroundPixmap; } SkinLoader::IncrementalLoader::LoaderResult SkinLoader::IncrementalLoader::loadStep() { switch ( m_currentState ) { case LoadBackgroundPixmap: - qDebug( "load bgpixmap" ); + odebug << "load bgpixmap" << oendl; m_skin.backgroundPixmap(); m_currentState = LoadButtonUpImage; break; case LoadButtonUpImage: - qDebug( "load upimage" ); + odebug << "load upimage" << oendl; m_skin.buttonUpImage(); m_currentState = LoadButtonDownImage; break; case LoadButtonDownImage: - qDebug( "load downimage" ); + odebug << "load downimage" << oendl; m_skin.buttonDownImage(); m_currentState = LoadButtonMasks; m_currentButton = 0; break; case LoadButtonMasks: - qDebug( "load button masks %i", m_currentButton ); + odebug << "load button masks " << m_currentButton << "" << oendl; m_skin.buttonMaskImage( m_info.buttonInfo[ m_currentButton ].fileName ); m_currentButton++; if ( m_currentButton >= m_info.buttonCount ) m_currentState = LoadButtonMask; break; case LoadButtonMask: - qDebug( "load whole mask" ); + odebug << "load whole mask" << oendl; m_skin.buttonMask( m_info.buttonInfo, m_info.buttonCount ); return LoadingCompleted; } return MoreToCome; } SkinLoader::SkinLoader() : m_currentLoader( 0 ), m_timerId( -1 ) { } SkinLoader::~SkinLoader() { - qDebug( "SkinLoader::~SkinLoader()" ); + odebug << "SkinLoader::~SkinLoader()" << oendl; killTimers(); delete m_currentLoader; } void SkinLoader::schedule( const MediaWidget::GUIInfo &guiInfo ) { schedule( Skin::defaultSkinName(), guiInfo ); } void SkinLoader::schedule( const QString &skinName, const MediaWidget::GUIInfo &guiInfo ) { pendingSkins << Info( skinName, guiInfo ); } void SkinLoader::start() { assert( m_timerId == -1 ); m_timerId = startTimer( 100 /* ms */ ); - qDebug( "SkinLoader::start() %d jobs", pendingSkins.count() ); + odebug << "SkinLoader::start() " << pendingSkins.count() << " jobs" << oendl; } void SkinLoader::timerEvent( QTimerEvent *ev ) { if ( ev->timerId() != m_timerId ) { QObject::timerEvent( ev ); return; } if ( !m_currentLoader ) { if ( pendingSkins.isEmpty() ) { - qDebug( "all jobs done" ); + odebug << "all jobs done" << oendl; killTimer( m_timerId ); m_timerId = -1; // ### qt3: use deleteLater(); QTimer::singleShot( 0, this, SLOT( deleteMe() ) ); return; } Info nfo = *pendingSkins.begin(); pendingSkins.remove( pendingSkins.begin() ); m_currentLoader = new IncrementalLoader( nfo ); - qDebug( "new loader %i jobs left", pendingSkins.count() ); + odebug << "new loader " << pendingSkins.count() << " jobs left" << oendl; } if ( m_currentLoader->loadStep() == IncrementalLoader::LoadingCompleted ) { delete m_currentLoader; m_currentLoader = 0; } - qDebug( "finished step" ); + odebug << "finished step" << oendl; } void SkinLoader::deleteMe() { delete this; } /* vim: et sw=4 ts=4 */ 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 @@ -174,42 +174,42 @@ Thread::Thread() : d( new Data ) { d->thr = this; } Thread::~Thread() { assert( d->isRunning == false ); delete d; } void Thread::start() { AutoLock lock( d->guard ); if ( d->isRunning ) { - qDebug( "ThreadUtil::Thread::start() called for running thread." ); + odebug << "ThreadUtil::Thread::start() called for running thread." << oendl; return; } pthread_attr_t attributes; pthread_attr_init( &attributes ); pthread_attr_setscope( &attributes, PTHREAD_SCOPE_SYSTEM ); int err = pthread_create( &d->self, &attributes, start_thread, ( void* )d ); if ( err != 0 ) { - qDebug( "ThreadUtil::Thread::start() : can't create thread: %s", strerror( err ) ); + odebug << "ThreadUtil::Thread::start() : can't create thread: " << strerror( err ) << "" << oendl; pthread_attr_destroy( &attributes ); return; } pthread_attr_destroy( &attributes ); } void Thread::terminate() { AutoLock lock( d->guard ); if ( !d->isRunning ) return; pthread_cancel( d->self ); } bool Thread::wait() @@ -271,33 +271,33 @@ void OnewayNotifier::wakeUp() ChannelMessage::ChannelMessage( int type ) : m_type( type ), m_isCall( false ), m_replied( false ), m_inEventHandler( false ) { } ChannelMessage::~ChannelMessage() { if ( m_guard.isLocked() ) m_guard.unlock(); } void ChannelMessage::reply() { if ( !m_isCall ) { - qDebug( "ChannelMessage::reply() - can't reply oneway message!" ); + odebug << "ChannelMessage::reply() - can't reply oneway message!" << oendl; return; } if ( m_inEventHandler ) { m_replied = true; return; } m_condition.wakeOne(); m_guard.unlock(); } struct Channel::Private { Private() 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 @@ -80,51 +80,51 @@ XineControl::~XineControl() { #if defined(Q_WS_QWS) && !defined(QT_NO_COP) if ( disabledSuspendScreenSaver ) { disabledSuspendScreenSaver = FALSE; // Re-enable the suspend mode QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; } #endif delete libXine; } void XineControl::play( const QString& fileName ) { hasVideoChannel = FALSE; hasAudioChannel = FALSE; m_fileName = fileName; - qDebug("<<FILENAME: " + fileName + ">>>>"); + odebug << "<<FILENAME: " + fileName + ">>>>" << oendl; if ( !libXine->play( fileName, 0, 0 ) ) { QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); // toggle stop so the the play button is reset mediaPlayerState.setPlaying( false ); return; } mediaPlayerState.setPlaying( true ); MediaPlayerState::DisplayType displayType; if ( !libXine->hasVideo() ) { displayType = MediaPlayerState::Audio; - qDebug("HAS AUDIO"); + odebug << "HAS AUDIO" << oendl; libXine->setShowVideo( false ); hasAudioChannel = TRUE; } else { displayType = MediaPlayerState::Video; - qDebug("HAS VIDEO"); + odebug << "HAS VIDEO" << oendl; libXine->setShowVideo( true ); hasVideoChannel = TRUE; } // determine if slider is shown mediaPlayerState.setIsSeekable( libXine->isSeekable() ); // which gui (video / audio) mediaPlayerState.setDisplayType( displayType ); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) if ( !disabledSuspendScreenSaver ) { disabledSuspendScreenSaver = TRUE; // Stop the screen from blanking and power saving state QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend ); } @@ -230,33 +230,33 @@ QString XineControl::getMetaInfo() { } if ( !libXine->metaInfo( 4 ).isEmpty() ) { returnString += tr( " Album: " + libXine->metaInfo( 4 ) ); } if ( !libXine->metaInfo( 5 ).isEmpty() ) { returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); } return returnString; } QString XineControl::getErrorCode() { int errorCode = libXine->error(); - qDebug( QString("ERRORCODE: %1 ").arg(errorCode) ); + odebug << QString("ERRORCODE: %1 ").arg(errorCode) << oendl; if ( errorCode == 1 ) { return tr( "No input plugin found for this media type" ); } else if ( errorCode == 2 ) { return tr( "No demux plugin found for this media type" ); } else if ( errorCode == 3 ) { return tr( "Demuxing failed for this media type" ); } else if ( errorCode == 4 ) { return tr( "Malformed MRL" ); } else { return tr( "Some other error" ); } } /** * Seek to a position in the track 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,54 +1,54 @@ // device.cpp #include "device.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> +using namespace Opie::Core; - +/* STD */ #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <sys/ioctl.h> #include <sys/soundcard.h> #include <unistd.h> #include<sys/wait.h> -// #include <sys/stat.h> -// #include <sys/time.h> -// #include <sys/types.h> #include <unistd.h> #include <errno.h> //extern QtRec *qperec; Device::Device( QObject * parent, const char * dsp, const char * mixr, bool record ) : QObject( parent) { dspstr = (char *)dsp; mixstr = (char *)mixr; devForm=-1; devCh=-1; devRate=-1; if( !record){ //playing - qDebug("setting up DSP for playing"); + odebug << "setting up DSP for playing" << oendl; flags = O_WRONLY; } else { //recording - qDebug("setting up DSP for recording"); + odebug << "setting up DSP for recording" << oendl; flags = O_RDWR; // flags = O_RDONLY; // selectMicInput(); } } bool Device::openDsp() { if( openDevice( flags) == -1) { perror("<<<<<<<<<<<<<<ioctl(\"Open device\")"); return false; } return true; } @@ -83,48 +83,48 @@ int Device::getInVolume() { cfg.setGroup("Volume"); return cfg.readNumEntry("Mic"); } void Device::changedOutVolume(int vol) { int level = (vol << 8) + vol; int fd = 0; if ((fd = open("/dev/mixer", O_RDWR))>=0) { if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_VOLUME), &level) == -1) perror("ioctl(\"MIXER_IN_WRITE\")"); Config cfg("qpe"); cfg.setGroup("Volume"); cfg.writeEntry("VolumePercent", QString::number( vol )); QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; - qWarning("changing output vol %d", vol); + owarn << "changing output vol " << vol << "" << oendl; } ::close(fd); } void Device::changedInVolume(int vol ) { int level = (vol << 8) + vol; int fd = 0; if ((fd = open("/dev/mixer", O_RDWR))>=0) { if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_MIC), &level) == -1) perror("ioctl(\"MIXER_IN_WRITE\")"); Config cfg("qpe"); cfg.setGroup("Volume"); cfg.writeEntry("Mic", QString::number(vol )); QCopEnvelope( "QPE/System", "micChange(bool)" ) << false; - qWarning("changing input volume %d", vol); + owarn << "changing input volume " << vol << "" << oendl; } ::close(fd); } bool Device::selectMicInput() { int md=0; int info=MIXER_WRITE(SOUND_MIXER_MIC); md = ::open( "/dev/mixer", O_RDWR ); if ( md == -1) perror("open(\"/dev/mixer\")"); else { if( ioctl( md, SOUND_MIXER_WRITE_RECSRC, &info) == -1) perror("ioctl(\"SOUND_MIXER_WRITE_RECSRC\")"); ::close(md); return false; @@ -136,139 +136,139 @@ bool Device::selectMicInput() { int Device::openDevice( int flags) { /* pid_t pid; int status; int pipefd[2]; char message[20]; if (pipe(pipefd) == -1){ perror ("Error creating pipe"); exit(1); } switch (pid = fork()) { case -1: perror("The fork failed!"); break; case 0: { */ -qDebug("Opening %s",dspstr); +odebug << "Opening " << dspstr << "" << oendl; if (( sd = ::open( dspstr, flags)) == -1) { perror("open(\"/dev/dsp\")"); QString errorMsg="Could not open audio device\n /dev/dsp\n" +(QString)strerror(errno); - qDebug("XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg); + odebug << "XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg << oendl; return -1; } -qDebug("Opening mixer"); +odebug << "Opening mixer" << oendl; int mixerHandle=0; if (( mixerHandle = open("/dev/mixer",O_RDWR))<0) { perror("open(\"/dev/mixer\")"); QString errorMsg="Could not open audio device\n /dev/dsp\n" +(QString)strerror(errno); - qDebug("XXXXXXXXXXXXXXXXXXXXXX "+errorMsg); + odebug << "XXXXXXXXXXXXXXXXXXXXXX "+errorMsg << oendl; } if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){ perror("ioctl RESET"); } // sprintf(message, "%d", sd); /* QFile f1("/pid"); f1.open(IO_WriteOnly ); f1.writeBlock(message, strlen(message)); f1.close(); */ /* close(pipefd[0]); write(pipefd[1], message, sizeof(message)); close(pipefd[1]); - // qDebug("%d",soundDevice->sd ); + // odebug << "" << soundDevice->sd << "" << oendl; _exit(0); } default: // pid greater than zero is parent getting the child's pid printf("Child's pid is %d\n",pid); QString s; close(pipefd[1]); read(pipefd[0], message, sizeof(message)); s = message; close(pipefd[0]); // while(wait(NULL)!=pid) // ; printf("child %ld terminated normally, return status is zero\n", (long) pid); */ // filePara.sd=(long) pid; /* QFile f2("/pid"); f2.open(IO_ReadOnly); QTextStream t(&f2); // for(int f=0; f < t.atEnd() ;f++) { s = t.readLine(); // } */ // bool ok; // sd = s.toInt(&ok, 10); -// qDebug("<<<<<<<<<<<<<>>>>>>>>>>>>"+s); +// odebug << "<<<<<<<<<<<<<>>>>>>>>>>>>"+s << oendl; // f2.close(); // } ::close(mixerHandle ); -// qDebug("open device %s", dspstr); -// qDebug("success! %d",sd); +// odebug << "open device " << dspstr << "" << oendl; +// odebug << "success! " << sd << "" << oendl; return sd; } bool Device::closeDevice( bool) { // if(b) {//close now // if (ioctl( sd, SNDCTL_DSP_RESET, 0) == -1) { // perror("ioctl(\"SNDCTL_DSP_RESET\")"); // } // } else { //let play // if (ioctl( sd, SNDCTL_DSP_SYNC, 0) == -1) { // perror("ioctl(\"SNDCTL_DSP_SYNC\")"); // } // } ::close( sd); //close sound device // sdfd=0; // sd=0; -// qDebug("closed dsp"); +// odebug << "closed dsp" << oendl; return true; } bool Device::setDeviceFormat( int form) { - qDebug("set device res %d %d", form, sd); + odebug << "set device res " << form << " " << sd << "" << oendl; if (ioctl( sd, SNDCTL_DSP_SETFMT, &form)==-1) { //set format perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); return false; } devRes=form; return true; } bool Device::setDeviceChannels( int ch) { - qDebug("set channels %d %d", ch, sd); + odebug << "set channels " << ch << " " << sd << "" << oendl; if (ioctl( sd, SNDCTL_DSP_CHANNELS, &ch)==-1) { perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); return false; } devCh=ch; return true; } bool Device::setDeviceRate( int rate) { - qDebug("set rate %d %d", rate, sd); + odebug << "set rate " << rate << " " << sd << "" << oendl; if (ioctl( sd, SNDCTL_DSP_SPEED, &rate) == -1) { perror("ioctl(\"SNDCTL_DSP_SPEED\")"); return false; } devRate=rate; return true; } int Device::getRes() { return devRes; } int Device::getFormat() { return devForm; @@ -305,35 +305,35 @@ int Device::getDeviceBits() { #endif return dBits; } int Device::getDeviceChannels() { int dCh=0; if (ioctl( sd, SOUND_PCM_READ_CHANNELS, &dCh) == -1) { perror("ioctl(\"SNDCTL_PCM_READ_CHANNELS\")"); } return dCh; } int Device::getDeviceFragSize() { int frag_size; if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) { - qDebug("no fragsize"); + odebug << "no fragsize" << oendl; } else { - qDebug("driver says frag size is %d", frag_size); + odebug << "driver says frag size is " << frag_size << "" << oendl; } return frag_size; } bool Device::setFragSize(int frag) { if (ioctl(sd, SNDCTL_DSP_SETFRAGMENT, &frag)) { perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")"); return false; } return true; } bool Device::reset() { closeDevice(true); openDsp(); if (ioctl( sd, SNDCTL_DSP_RESET, 0) == -1) { 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,44 +1,49 @@ /**************************************************************************** ** $Id$ ** ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. ** ** This file is part of an example program for Qt. This example ** program may be used, distributed and modified without limitation. ** *****************************************************************************/ #include "helpwindow.h" -#include <qlayout.h> -#include <qtoolbar.h> +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/resource.h> +using namespace Opie::Core; +/* QT */ +#include <qlayout.h> +#include <qtoolbar.h> #include <qaction.h> #include <qmenubar.h> +/* STD */ #include <ctype.h> HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name ) : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL() { QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 2); layout->setMargin( 2); - qDebug(_path); + odebug << _path << oendl; browser = new QTextBrowser( this ); QStringList Strlist; Strlist.append( home_); browser->mimeSourceFactory()->setFilePath( Strlist ); browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); connect( browser, SIGNAL( textChanged() ), this, SLOT( textChanged() ) ); if ( !home_.isEmpty() ) browser->setSource( home_ ); QToolBar *toolbar = new QToolBar( this ); QAction *a = new QAction( tr( "Backward" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), browser, SLOT( backward() ) ); a->addTo( toolbar ); 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,41 +1,39 @@ -#CONFIG = qt warn_on pdaudio -CONFIG = qt warn_on opie -#CONFIG = qt warn_on quick-app +CONFIG = qt warn_on HEADERS = adpcm.h \ pixmaps.h \ helpwindow.h \ qtrec.h \ device.h \ wavFile.h \ waveform.h SOURCES = adpcm.c \ helpwindow.cpp \ main.cpp \ qtrec.cpp \ device.cpp \ wavFile.cpp \ waveform.cpp INTERFACES = contains(CONFIG, pdaudio) { # LIBS += -L/opt/buildroot-opie/output/staging/target/lib -lqpe -lpthread -ljpeg -lpng -lz LIBS += -L$(QPEDIR)/lib -lqpe -lpthread -ljpeg -lpng -lz -lopiecore2 INCLUDEPATH += $(QPEDIR)/include DEPENDPATH += $(QPEDIR)/include DEFINES += PDAUDIO DEFINES += THREADED TARGET = qperec # DESTDIR=$(QPEDIR)/bin } -contains(CONFIG, opie) { +!contains(CONFIG, pdaudio) { INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include DESTDIR=$(OPIEDIR)/bin LIBS += -lqpe -lopiecore2 -lpthread TARGET = opierec include ( $(OPIEDIR)/include.pro ) } 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,72 +1,71 @@ /**************************************************************************** // qtrec.cpp Created: Thu Jan 17 11:19:58 2002 copyright 2002 by L.J. Potter <ljp@llornkcor.com> ****************************************************************************/ #define DEV_VERSION #include "pixmaps.h" #include "qtrec.h" #include "waveform.h" - -#include <pthread.h> - extern "C" { #include "adpcm.h" } -#include <sys/soundcard.h> - +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/storage.h> +using namespace Opie::Core; +/* QT */ #include <qcheckbox.h> #include <qcombobox.h> -//#include <qdatetime.h> #include <qdir.h> #include <qgroupbox.h> #include <qlabel.h> #include <qlayout.h> #include <qlistview.h> #include <qmessagebox.h> #include <qpopupmenu.h> #include <qpushbutton.h> #include <qslider.h> #include <qtabwidget.h> #include <qtimer.h> +/* STD */ #include <errno.h> #include <fcntl.h> #include <math.h> #include <mntent.h> #include <stdio.h> #include <stdlib.h> #include <sys/ioctl.h> #include <sys/soundcard.h> #include <sys/stat.h> #include <sys/time.h> #include <sys/types.h> #include <sys/vfs.h> #include <unistd.h> #include <sys/wait.h> #include <sys/signal.h> - +#include <pthread.h> #ifdef PDAUDIO //ALSA #include <alsa/asoundlib.h> static int deviceSampleRates[8] = { 32000, 44100, 48000, 88200, 96000, 176400, 192000, -1 }; static int deviceBitRates[] = { 8, 16, 24, 32, -1 }; #else //OSS static int deviceSampleRates[6] = { 11025, 16000, 22050, 32000, 44100, -1 }; static int deviceBitRates[] = { 8, 16, -1 }; #endif #if defined(QT_QWS_SL5XXX) ///#if defined(QT_QWS_EBX) #define DSPSTROUT "/dev/dsp" #define DSPSTRIN "/dev/dsp1" #define DSPSTRMIXEROUT "/dev/mixer" @@ -123,107 +122,107 @@ void quickRec() { qDebug("%d", filePara.numberSamples/filePara.sampleRate * filePara.channels); qDebug("samples %d, rate %d, channels %d", filePara.numberSamples, filePara.sampleRate, filePara.channels); int total = 0; // Total number of bytes read in so far. int bytesWritten, number; bytesWritten = 0; number = 0; QString num; int level = 0; int threshold = 0; // int bits = filePara.resolution; -// qDebug("bits %d", bits); +// odebug << "bits " << bits << "" << oendl; if( filePara.resolution == 16 ) { //AFMT_S16_LE) -// qDebug("AFMT_S16_LE size %d", filePara.SecondsToRecord); -// qDebug("samples to record %d", filePara.samplesToRecord); -// qDebug("%d", filePara.sd); +// odebug << "AFMT_S16_LE size " << filePara.SecondsToRecord << "" << oendl; +// odebug << "samples to record " << filePara.samplesToRecord << "" << oendl; +// odebug << "" << filePara.sd << "" << oendl; level = 7; threshold = 0; if( filePara.format == WAVE_FORMAT_DVI_ADPCM) { -// qDebug("start recording WAVE_FORMAT_DVI_ADPCM"); +// odebug << "start recording WAVE_FORMAT_DVI_ADPCM" << oendl; // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> char abuf[ BUFSIZE/2 ]; short sbuf[ BUFSIZE ]; short sbuf2[ BUFSIZE ]; memset( abuf, 0, BUFSIZE/2); memset( sbuf, 0, BUFSIZE); memset( sbuf2, 0, BUFSIZE); for(;;) { if ( stopped) { -// qDebug("quickRec:: stopped"); +// odebug << "quickRec:: stopped" << oendl; break; } // number=::read( filePara.sd, sbuf, BUFSIZE); number = soundDevice ->devRead( filePara.sd, sbuf, BUFSIZE); if(number <= 0) { perror("recording error "); - qDebug( "%s %d", filePara.fileName, number); + odebug << "" << filePara.fileName << " " << number << "" << oendl; stopped = true; return; } //if(stereo == 2) { // adpcm_coder( sbuf2, abuf, number/2, &encoder_state); adpcm_coder( sbuf, abuf, number/2, &encoder_state); bytesWritten = ::write( filePara.fd , (short *)abuf, number/4); waveform->newSamples( (const short *)abuf, bytesWritten ); total += bytesWritten; filePara.numberSamples = total; timeSlider->setValue( total); filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2 / filePara.channels; qApp->processEvents(); if( total >= filePara.samplesToRecord) { stopped = true; break; } } } else { // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>> - qDebug("start recording WAVE_FORMAT_PCM"); + odebug << "start recording WAVE_FORMAT_PCM" << oendl; short inbuffer[ BUFSIZE ], outbuffer[ BUFSIZE ]; memset( inbuffer, 0, BUFSIZE); memset( outbuffer, 0, BUFSIZE); for(;;) { if ( stopped) { - qDebug("quickRec:: stopped"); + odebug << "quickRec:: stopped" << oendl; stopped = true; break; // stop if playing was set to false return; } number = soundDevice->devRead( filePara.sd, (short *)inbuffer, BUFSIZE); waveform->newSamples( inbuffer, number ); if( number <= 0) { perror( "recording error "); - qDebug( filePara.fileName); + odebug << filePara.fileName << oendl; stopped = true; return; } bytesWritten = ::write( filePara.fd , inbuffer, number); if( bytesWritten < 0) { perror("File writing error "); stopped = true; return; } total += bytesWritten; filePara.numberSamples = total; @@ -237,33 +236,33 @@ void quickRec() if( total >= filePara.samplesToRecord) { stopped = true; break; } } } //end main loop } else { // <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8; unsigned char unsigned_inbuffer[ BUFSIZE ], unsigned_outbuffer[ BUFSIZE ]; memset( unsigned_inbuffer, 0, BUFSIZE); memset( unsigned_outbuffer, 0, BUFSIZE); for(;;) { if ( stopped) { - qDebug("quickRec:: stopped"); + odebug << "quickRec:: stopped" << oendl; break; // stop if playing was set to false } number = ::read( filePara.sd, unsigned_inbuffer, BUFSIZE); bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number); if(bytesWritten < 0) { stopped = true; QMessageBox::message("Note","There was a problem\nwriting to the file"); perror("File writing error "); return; } total += bytesWritten; filePara.numberSamples = total; // printf("\nWriting number %d, bytes %d,total %d \r",number, bytesWritten , total); @@ -360,33 +359,33 @@ void playIt() // total+=bytesWritten; // if(filePara.channels==1) // total += bytesWritten/2; //mono // else total += bytesWritten; timeSlider->setValue( total); filePara.numberSamples = total; filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2; // timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds); // timeLabel->setText( timeString + tr(" seconds")); qApp->processEvents(); if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { - qWarning("Jane! Stop this crazy thing!"); + owarn << "Jane! Stop this crazy thing!" << oendl; stopped = true; // playing = false; break; } } printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total); fflush(stdout); } //end loop } else { /////////////////////////////// format = AFMT_U8; unsigned char unsigned_inbuffer[ BUFSIZE ]; //, unsigned_outbuffer[BUFSIZE]; memset( unsigned_inbuffer, 0, BUFSIZE); for(;;) { // main loop if (stopped) { break; // stop if playing was set to false @@ -705,33 +704,33 @@ void QtRec::init() { // waveform->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, waveform->sizePolicy().hasHeightForWidth() ) ); waveform->setMinimumSize( QSize( 0, 50 ) ); layout->addMultiCellWidget( waveform, 8, 8, 0, 7 ); waveform->setBackgroundColor ( black ); } void QtRec::initIconView() { ListView1->clear(); Config cfg("OpieRec"); cfg.setGroup("Sounds"); QString temp; QPixmap image0( ( const char** ) image0_data ); int nFiles = cfg.readNumEntry("NumberofFiles",0); -// qDebug("init number of files %d", nFiles); +// odebug << "init number of files " << nFiles << "" << oendl; for(int i=1;i<= nFiles;i++) { QListViewItem * item; QString fileS, mediaLocation, fileDate, filePath; temp.sprintf( "%d",i); temp = cfg.readEntry( temp,""); //reads currentFile filePath = cfg.readEntry( temp,""); //currentFileName QFileInfo info(filePath); fileDate = info.lastModified().toString(); fileS = cfg.readEntry( filePath, "0" );// file length in seconds mediaLocation = getStorage( filePath); if( info.exists()) { @@ -847,33 +846,33 @@ void QtRec::initConfig() { filePara.resolution=16; } autoMuteCheckBox->setChecked( cfg.readBoolEntry("useAutoMute",0)); if( autoMuteCheckBox->isChecked()) slotAutoMute(true); else slotAutoMute(false); Config cofg( "qpe"); cofg.setGroup( "Volume"); outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); } void QtRec::stop() { - qWarning("STOP"); + owarn << "STOP" << oendl; setRecordButton(false); if( !recording) endPlaying(); else endRecording(); timeSlider->setValue(0); } void QtRec::doPlayBtn() { if(!stopped) { playLabel2->setText(tr("Play")); stop(); } else { if(ListView1->currentItem() == 0) return; @@ -909,77 +908,77 @@ bool QtRec::rec() { //record secCount = 1; playLabel2->setText(tr("Stop")); monitoring = false; setRecordButton( true); if( setupAudio( true)) if(setUpFile()) { int fileSize = 0; Config cfg("OpieRec"); cfg.setGroup("Settings"); // qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d", // soundDevice->getDeviceBits(), // soundDevice->getDeviceRate(), // soundDevice->getDeviceChannels()); //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); -// qDebug("sample rate is %d", filePara.sampleRate); +// odebug << "sample rate is " << filePara.sampleRate << "" << oendl; filePara.SecondsToRecord = getCurrentSizeLimit(); -// qDebug("size limit %d sec", filePara.SecondsToRecord); +// odebug << "size limit " << filePara.SecondsToRecord << " sec" << oendl; int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); if( filePara.SecondsToRecord == 0) { fileSize = diskSize; } else if( filePara.format == WAVE_FORMAT_PCM) { -// qDebug("WAVE_FORMAT_PCM"); +// odebug << "WAVE_FORMAT_PCM" << oendl; fileSize = (filePara.SecondsToRecord ) * filePara.channels * filePara.sampleRate * ( filePara.resolution / 8) + 1000; } else { -// qDebug("WAVE_FORMAT_DVI_ADPCM"); +// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; fileSize = ((filePara.SecondsToRecord) * filePara.channels * filePara.sampleRate * ( filePara.resolution / 8) ) / 4 + 250; } filePara.samplesToRecord = fileSize; qDebug("filesize should be %d, bits %d, rate %d", filePara.samplesToRecord, filePara.resolution, filePara.sampleRate); if( paused) { paused = false; } // else { - qDebug("Setting timeslider %d", filePara.samplesToRecord); + odebug << "Setting timeslider " << filePara.samplesToRecord << "" << oendl; // if(fileSize != 0) timeSlider->setRange(0, filePara.samplesToRecord); // } if( diskSize < fileSize/1024) { QMessageBox::warning(this, tr("Low Disk Space"), tr("You are running low of\nrecording space\n" "or a card isn't being recognized")); stopped = true; //we need to be stopped stop(); } else { QString msg; msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); #ifdef DEV_VERSION setCaption( msg); #endif filePara.fileName=currentFile.latin1(); - qDebug("Start recording thread"); + odebug << "Start recording thread" << oendl; stopped = false; #ifdef THREADED pthread_t thread1; pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); #endif toBeginningButton->setEnabled( false); toEndButton->setEnabled( false); startTimer(1000); #ifndef THREADED quickRec(); #endif } } //end setUpFile } //end setupAudio @@ -997,39 +996,39 @@ void QtRec::thisTab(QWidget* widg) { if(index == 1) { //control page fillDirectoryCombo(); // soundDevice->getOutVol(); // soundDevice->getInVol(); } if( index==2) { //help page } qApp->processEvents(); update(); } } void QtRec::getOutVol( ) { filePara.outVol = soundDevice->getOutVolume(); -// qDebug("out vol %d", filePara.outVol); +// odebug << "out vol " << filePara.outVol << "" << oendl; OutputSlider->setValue( -filePara.outVol); } void QtRec::getInVol() { filePara.inVol = soundDevice->getInVolume(); -// qDebug("in vol %d", filePara.inVol); +// odebug << "in vol " << filePara.inVol << "" << oendl; InputSlider->setValue( -filePara.inVol); } void QtRec::changedOutVolume() { soundDevice->changedOutVolume( -OutputSlider->value()); } void QtRec::changedInVolume( ) { soundDevice->changedInVolume( -InputSlider->value()); } bool QtRec::setupAudio( bool b) { bool ok; int sampleformat, stereo, flags; QString dspString, mixerString; @@ -1077,125 +1076,125 @@ bool QtRec::setupAudio( bool b) { sampleformat = SND_PCM_FORMAT_S16; else if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "24") sampleformat = SND_PCM_FORMAT_S24; else if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "32") sampleformat = SND_PCM_FORMAT_S32; else sampleformat = SND_PCM_FORMAT_U8; #else if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16") sampleformat = AFMT_S16_LE; else sampleformat = AFMT_U8; if( !compressionCheckBox->isChecked()) { filePara.format = WAVE_FORMAT_PCM; -// qDebug("WAVE_FORMAT_PCM"); +// odebug << "WAVE_FORMAT_PCM" << oendl; } else { filePara.format = WAVE_FORMAT_DVI_ADPCM; sampleformat = AFMT_S16_LE; -// qDebug("WAVE_FORMAT_DVI_ADPCM"); +// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; } #endif stereo = filePara.channels; // filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100; flags= O_RDWR; // flags= O_RDONLY; Config hwcfg("OpieRec"); hwcfg.setGroup("Hardware"); dspString = hwcfg.readEntry( "Audio", DSPSTRIN); mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXERIN); recording = true; } // if(soundDevice) delete soundDevice; - qDebug("<<<<<<<<<<<<<<<<<<<open dsp %d %d %d", filePara.sampleRate, filePara.channels, sampleformat); - qWarning("change waveform settings"); + odebug << "<<<<<<<<<<<<<<<<<<<open dsp " << filePara.sampleRate << " " << filePara.channels << " " << sampleformat << "" << oendl; + owarn << "change waveform settings" << oendl; waveform->changeSettings( filePara.sampleRate, filePara.channels ); soundDevice = new Device( this, dspString, mixerString, b); // soundDevice->openDsp(); soundDevice->reset(); - qDebug("device has been made %d", soundDevice->sd); + odebug << "device has been made " << soundDevice->sd << "" << oendl; ////////////////// <<<<<<<<<<<<>>>>>>>>>>>> soundDevice->setDeviceFormat( sampleformat); soundDevice->setDeviceChannels( filePara.channels); soundDevice->setDeviceRate( filePara.sampleRate); soundDevice->getDeviceFragSize(); #ifdef QT_QWS_EBX int frag = FRAGSIZE; soundDevice->setFragSize( frag); soundDevice->getDeviceFragSize(); #endif ///////////////// filePara.sd = soundDevice->sd; if ( filePara.sd == -1) { monitoring = false; stopped = true; update(); setCaption( tr( "OpieRecord " )+ QString::number(VERSION) ); return false; } if(autoMute) doMute(false); return true; } bool QtRec::setUpFile() { //setup file for recording -// qDebug("Setting up wavfile"); +// odebug << "Setting up wavfile" << oendl; // if(wavFile) delete wavFile; wavFile = new WavFile( this, (const QString &)"", true, filePara.sampleRate, filePara.channels, filePara.resolution, filePara.format); filePara.fd = wavFile->wavHandle(); if(filePara.fd == -1) { return false; } else { // filePara.channels=1; } return true; } /// <<<<<<<<<<<<<<<< PLAY >>>>>>>>>>>>>>>>>>> bool QtRec::doPlay() { if( !paused) { total = 0; filePara.numberOfRecordedSeconds = 0; } else { paused = false; secCount = (int)filePara.numberOfRecordedSeconds; } playing = true; stopped = false; recording = false; QString num; - qDebug( "Play number of samples %d", filePara.numberSamples); + odebug << "Play number of samples " << filePara.numberSamples << "" << oendl; // timeSlider->setRange( 0, filePara.numberSamples); timeString.sprintf("%f", filePara.numberOfRecordedSeconds); timeLabel->setText( timeString+ tr(" seconds")); QString msg; msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); #ifdef DEV_VERSION setCaption( msg); #endif startTimer( 1000); @@ -1221,53 +1220,53 @@ void QtRec::changebitrateCombo(int i) { else if( i == 2) { bits = 24; } else if( i == 3) { bits = 32; } else { bits=8; } cfg.writeEntry("bitrate", bits); filePara.resolution = bits; cfg.write(); } void QtRec::changesamplerateCombo(int i) { Config cfg("OpieRec"); cfg.setGroup("Settings"); int rate=0; bool ok; rate = sampleRateComboBox->text(i).toInt(&ok, 10); cfg.writeEntry( "samplerate",rate); filePara.sampleRate=rate; - qDebug( "Change sample rate %d", rate); + odebug << "Change sample rate " << rate << "" << oendl; cfg.write(); } void QtRec::changeDirCombo(int index) { Config cfg("OpieRec"); cfg.setGroup("Settings"); QString sName = directoryComboBox->text(index); StorageInfo storageInfo; const QList<FileSystem> &fs = storageInfo.fileSystems(); QListIterator<FileSystem> it ( fs ); QString storage; for( ; it.current(); ++it ){ if( sName == (*it)->name()+" "+ (*it)->path() || (*it)->name() == sName ) { const QString path = (*it)->path(); recDir = path; cfg.writeEntry("directory", recDir); - qDebug("new rec dir "+recDir); + odebug << "new rec dir "+recDir << oendl; } } cfg.write(); } void QtRec::changeSizeLimitCombo(int) { Config cfg("OpieRec"); cfg.setGroup("Settings"); cfg.writeEntry("sizeLimit", getCurrentSizeLimit() ); cfg.write(); } void QtRec::newSound() { if( !rec()) { endRecording(); @@ -1361,33 +1360,33 @@ void QtRec::keyPressEvent( QKeyEvent *e) { break; case Key_F12: //home break; case Key_F13: //mail break; case Key_Space: break; case Key_Delete: break; case Key_Up: // stop(); break; case Key_Down: // newSound(); break; case Key_Left: { - qDebug("rewinding"); + odebug << "rewinding" << oendl; if( !e->isAutoRepeat()) rewindPressed(); } break; case Key_Right: { if( !e->isAutoRepeat()) FastforwardPressed(); } break; } } void QtRec::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { // case Key_F1: // if(stopped && !recording) @@ -1415,45 +1414,45 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) { else stop(); break; case Key_F13: //mail break; case Key_Space: if(stopped && !recording) newSound(); else stop(); break; case Key_Delete: deleteSound(); break; case Key_Up: // stop(); - qDebug("Up"); + odebug << "Up" << oendl; break; case Key_Down: // start(); - // qDebug("Down"); + // odebug << "Down" << oendl; // newSound(); break; case Key_Left: - qDebug("Left"); + odebug << "Left" << oendl; rewindReleased(); break; case Key_Right: - qDebug("Right"); + odebug << "Right" << oendl; FastforwardReleased(); break; } } void QtRec::endRecording() { monitoring = false; recording = false; stopped = true; waveform->reset(); setRecordButton( false); toBeginningButton->setEnabled( true); toEndButton->setEnabled( true); killTimers(); @@ -1462,147 +1461,147 @@ void QtRec::endRecording() { doMute( true); soundDevice->closeDevice( true); if( wavFile->track.isOpen()) { wavFile->adjustHeaders( filePara.fd, filePara.numberSamples); // soundDevice->sd=-1; filePara.numberSamples = 0; // filePara.sd=-1; wavFile->closeFile(); filePara.fd=0; if( wavFile->isTempFile()) { // move tmp file to regular file QString cmd; cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); -// qDebug("moving tmp file to "+currentFileName); +// odebug << "moving tmp file to "+currentFileName << oendl; system( cmd.latin1()); } - qDebug("Just moved " + wavFile->currentFileName); + odebug << "Just moved " + wavFile->currentFileName << oendl; Config cfg("OpieRec"); cfg.setGroup("Sounds"); int nFiles = cfg.readNumEntry( "NumberofFiles",0); currentFile = QFileInfo( wavFile->currentFileName).fileName(); currentFile = currentFile.left( currentFile.length() - 4); cfg.writeEntry( "NumberofFiles", nFiles + 1); cfg.writeEntry( QString::number( nFiles + 1), currentFile); cfg.writeEntry( currentFile, wavFile->currentFileName); QString time; time.sprintf("%.2f", filePara.numberOfRecordedSeconds); cfg.writeEntry( wavFile->currentFileName, time ); -// qDebug("writing config numberOfRecordedSeconds "+time); +// odebug << "writing config numberOfRecordedSeconds "+time << oendl; cfg.write(); - qDebug("finished recording"); + odebug << "finished recording" << oendl; timeLabel->setText(""); } if(soundDevice) delete soundDevice; timeSlider->setValue(0); initIconView(); selectItemByName( currentFile); } void QtRec::endPlaying() { monitoring = false; recording = false; playing = false; stopped = true; waveform->reset(); // errorStop(); -// qDebug("end playing"); +// odebug << "end playing" << oendl; setRecordButton( false); toBeginningButton->setEnabled( true); toEndButton->setEnabled( true); if(autoMute) doMute( true); soundDevice->closeDevice( false); soundDevice->sd = -1; // if(soundDevice) delete soundDevice; -// qDebug("file and sound device closed"); +// odebug << "file and sound device closed" << oendl; timeLabel->setText(""); total = 0; filePara.numberSamples = 0; filePara.sd = -1; // wavFile->closeFile(); filePara.fd = 0; // if(wavFile) delete wavFile; //this crashes -// qDebug("track closed"); +// odebug << "track closed" << oendl; killTimers(); - qWarning("reset slider"); + owarn << "reset slider" << oendl; timeSlider->setValue(0); if(soundDevice) delete soundDevice; } bool QtRec::openPlayFile() { qApp->processEvents(); if( currentFile.isEmpty()) { QMessageBox::message(tr("Opierec"),tr("Please select file to play")); endPlaying(); return false; } QString currentFileName; Config cfg("OpieRec"); cfg.setGroup("Sounds"); int nFiles = cfg.readNumEntry( "NumberofFiles", 0); for(int i=0;i<nFiles+1;i++) { //look for file if( cfg.readEntry( QString::number(i),"").find( currentFile,0,true) != -1) { currentFileName = cfg.readEntry( currentFile, "" ); - qDebug("opening for play: " + currentFileName); + odebug << "opening for play: " + currentFileName << oendl; } } wavFile = new WavFile(this, currentFileName, false); filePara.fd = wavFile->wavHandle(); if(filePara.fd == -1) { // if(!track.open(IO_ReadOnly)) { QString errorMsg = (QString)strerror(errno); monitoring = false; setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); QMessageBox::message(tr("Note"), tr("Could not open audio file.\n") + errorMsg + "\n" + currentFile); return false; } else { filePara.numberSamples = wavFile->getNumberSamples(); filePara.format = wavFile->getFormat(); filePara.sampleRate = wavFile->getSampleRate(); filePara.resolution = wavFile->getResolution(); filePara.channels = wavFile->getChannels(); timeSlider->setPageStep(1); monitoring = true; - qDebug("file %d, samples %d %d", filePara.fd, filePara.numberSamples, filePara.sampleRate); + odebug << "file " << filePara.fd << ", samples " << filePara.numberSamples << " " << filePara.sampleRate << "" << oendl; int sec = (int) (( filePara.numberSamples / filePara.sampleRate) / filePara.channels) / ( filePara.channels*( filePara.resolution/8)); - qWarning("seconds %d", sec); + owarn << "seconds " << sec << "" << oendl; timeSlider->setRange(0, filePara.numberSamples ); } return true; } void QtRec::listPressed( int mouse, QListViewItem *item, const QPoint &, int ) { if(item == NULL ) return; switch (mouse) { case 1: { if( renameBox != 0 ) //tricky cancelRename(); currentFile = item->text(0); @@ -1677,45 +1676,45 @@ void QtRec::doRename() { renameBox = new QLineEdit( ListView1->viewport(), "qt_renamebox" ); renameBox->setFrame(true); renameBox->setText( ListView1->currentItem()->text(0) ); renameBox->selectAll(); renameBox->installEventFilter( this ); ListView1->addChild( renameBox, r.x(), r.y() ); renameBox->resize( r.size() ); ListView1->viewport()->setFocusProxy( renameBox ); renameBox->setFocus(); renameBox->show(); } void QtRec::okRename() { - qDebug(renameBox->text()); + odebug << renameBox->text() << oendl; QString filename = renameBox->text(); cancelRename(); if( ListView1->currentItem() == NULL) return; Config cfg("OpieRec"); cfg.setGroup("Sounds"); QString file = ListView1->currentItem()->text(0); - qDebug("filename is " + filename); + odebug << "filename is " + filename << oendl; int nFiles = cfg.readNumEntry("NumberofFiles",0); for(int i=0;i<nFiles+1;i++) { //look for file if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) { QString filePath = cfg.readEntry(file,""); cfg.writeEntry( QString::number(i), filename ); cfg.writeEntry( filename, filePath ); cfg.removeEntry( file); cfg.write(); } } ListView1->takeItem( ListView1->currentItem() ); @@ -1760,33 +1759,33 @@ int QtRec::getCurrentSizeLimit() { return sizeLimitCombo->currentItem() * 5; } void QtRec::timerBreak() { endPlaying(); } void QtRec::doVolMuting(bool b) { Config cfg( "qpe" ); cfg. setGroup( "Volume" ); cfg.writeEntry( "Mute",b); cfg.write(); QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << b; } void QtRec::doMicMuting(bool b) { - // qDebug("mic mute"); + // odebug << "mic mute" << oendl; Config cfg( "qpe" ); cfg. setGroup( "Volume" ); cfg.writeEntry( "MicMute",b); cfg.write(); QCopEnvelope( "QPE/System", "micChange(bool)" ) << b; } void QtRec::compressionSelected(bool b) { Config cfg("OpieRec"); cfg.setGroup("Settings"); cfg.writeEntry("wavCompression", b); cfg.writeEntry("bitrate", 16); filePara.resolution = 16; cfg.write(); if(b) { @@ -1816,142 +1815,142 @@ long QtRec::checkDiskSpace(const QString &path) { return availBlks * mult / div; } return -1; } // short f_fstyp; /* File system type */ // long f_bsize; /* Block size */ // long f_frsize; /* Fragment size */ // long f_blocks; /* Total number of blocks*/ // long f_bfree; /* Count of free blocks */ // long f_files; /* Total number of file nodes */ // long f_ffree; /* Count of free file nodes */ // char f_fname[6]; /* Volumename */ // char f_fpack[6]; /* Pack name */ void QtRec::receive( const QCString &msg, const QByteArray & ) { - qDebug("Voicerecord received message "+msg); + odebug << "Voicerecord received message "+msg << oendl; } ///////////////////////////// timerEvent void QtRec::timerEvent( QTimerEvent * ) { // if(!recording) // timeSlider->setValue( secCount); // else // timeSlider->setValue( filePara.numberOfRecordedSeconds); if( stopped && playing) { stop(); } if( stopped && recording ){ stop(); } if( recording && filePara.SecondsToRecord < secCount && filePara.SecondsToRecord != 0) { stop(); } - qDebug( "%d", secCount ); + odebug << "" << secCount << "" << oendl; QString timeString; #ifdef DEV_VERSION QString msg; msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); setCaption( msg +" :: "+QString::number(secCount)); #endif timeString.sprintf("%d", secCount); timeLabel->setText( timeString + " seconds"); secCount++; } void QtRec::changeTimeSlider(int index) { if( ListView1->currentItem() == 0 || !wavFile->track.isOpen()) return; - // qDebug("Slider moved to %d",index); + // odebug << "Slider moved to " << index << "" << oendl; paused = true; stopped = true; sliderPos=index; QString timeString; filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2; timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); secCount = (int)filePara.numberOfRecordedSeconds; timeLabel->setText( timeString + tr(" seconds")); } void QtRec::timeSliderPressed() { if( ListView1->currentItem() == 0) return; - // qDebug("slider pressed"); + // odebug << "slider pressed" << oendl; paused = true; stopped = true; } void QtRec::timeSliderReleased() { if( ListView1->currentItem() == 0) return; sliderPos = timeSlider->value(); - // qDebug("slider released %d", sliderPos); + // odebug << "slider released " << sliderPos << "" << oendl; stopped = false; int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); total = newPos*4; filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2; doPlay(); } void QtRec::rewindPressed() { if( ListView1->currentItem() == 0) return; if( !wavFile->track.isOpen()) { if( !openPlayFile() ) return; else if( !setupAudio( false)) return; } else { killTimers(); paused = true; stopped = true; rewindTimer->start( 50, false); } } void QtRec::rewindTimerTimeout() { int sliderValue = timeSlider->value(); sliderValue = sliderValue - ( filePara.numberSamples / 100); // if(toBeginningButton->isDown()) timeSlider->setValue( sliderValue ) ; - // qDebug("%d", sliderValue); + // odebug << "" << sliderValue << "" << oendl; QString timeString; filePara.numberOfRecordedSeconds = (float)sliderValue / (float)filePara.sampleRate * (float)2; timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); timeLabel->setText( timeString+ tr(" seconds")); } void QtRec::rewindReleased() { rewindTimer->stop(); if( wavFile->track.isOpen()) { sliderPos=timeSlider->value(); stopped = false; int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); total = newPos * 4; - // qDebug("rewind released %d", total); + // odebug << "rewind released " << total << "" << oendl; startTimer( 1000); doPlay(); } } void QtRec::FastforwardPressed() { if( ListView1->currentItem() == 0) return; if( !wavFile->track.isOpen()) if( !openPlayFile() ) return; else if( !setupAudio( false)) return; killTimers(); paused = true; @@ -1989,33 +1988,33 @@ void QtRec::FastforwardReleased() { QString QtRec::getStorage(const QString &fileName) { StorageInfo storageInfo; const QList<FileSystem> &fs = storageInfo.fileSystems(); QListIterator<FileSystem> it ( fs ); QString storage; for( ; it.current(); ++it ){ const QString name = ( *it)->name(); const QString path = ( *it)->path(); const QString disk = ( *it)->disk(); if( fileName.find( path,0,true) != -1) storage = name; // const QString options = (*it)->options(); // if( name.find( tr("Internal"),0,true) == -1) { // storageComboBox->insertItem( name +" -> "+disk); - // qDebug(name); + // odebug << name << oendl; } return storage; // struct mntent *me; // // if(fileName == "/etc/mtab") { // FILE *mntfp = setmntent( fileName.latin1(), "r" ); // if ( mntfp ) { // while ( (me = getmntent( mntfp )) != 0 ) { // QString filesystemType = me->mnt_type; // } // } // endmntent( mntfp ); } void QtRec::setRecordButton(bool b) { 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,278 +1,281 @@ //wavFile.cpp #include "wavFile.h" #include "qtrec.h" +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/config.h> +using namespace Opie::Core; + +/* QT */ #include <qmessagebox.h> #include <qdir.h> -#include <qpe/config.h> - +/* STD */ #include <errno.h> - #include <sys/time.h> #include <sys/types.h> #include <sys/vfs.h> - #include <fcntl.h> #include <math.h> #include <mntent.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> WavFile::WavFile( QObject * parent,const QString &fileName, bool makeNwFile, int sampleRate, int channels, int resolution, int format ) : QObject( parent) { -//qDebug("new wave file"); +//odebug << "new wave file" << oendl; bool b = makeNwFile; wavSampleRate=sampleRate; wavFormat=format; wavChannels=channels; wavResolution=resolution; useTmpFile=false; if( b) { newFile(); } else { openFile(fileName); } } bool WavFile::newFile() { -// qDebug("Set up new file"); +// odebug << "Set up new file" << oendl; Config cfg("OpieRec"); cfg.setGroup("Settings"); currentFileName=cfg.readEntry("directory",QDir::homeDirPath()); QString date; QDateTime dt = QDateTime::currentDateTime(); date = dt.toString();//TimeString::dateString( QDateTime::currentDateTime(),false,true); date.replace(QRegExp("'"),""); date.replace(QRegExp(" "),"_"); date.replace(QRegExp(":"),"."); date.replace(QRegExp(","),""); QString currentFile=date; if(currentFileName.right(1).find("/",0,true) == -1) currentFileName += "/" + date; else currentFileName += date; currentFileName+=".wav"; -// qDebug("set up file for recording: "+currentFileName); +// odebug << "set up file for recording: "+currentFileName << oendl; char pointer[] = "/tmp/opierec-XXXXXX"; int fd = 0; if( currentFileName.find("/mnt",0,true) == -1 && currentFileName.find("/tmp",0,true) == -1 ) { // if destination file is most likely in flash (assuming jffs2) // we have to write to a different filesystem first useTmpFile = true; if(( fd = mkstemp( pointer)) < 0 ) { perror("mkstemp failed"); return false; } -// qDebug("Opening tmp file %s",pointer); +// odebug << "Opening tmp file " << pointer << "" << oendl; track.setName( pointer); } else { //just use regular file.. no moving useTmpFile = false; track.setName( currentFileName); } if(!track.open( IO_ReadWrite | IO_Truncate)) { QString errorMsg=(QString)strerror(errno); - qDebug(errorMsg); + odebug << errorMsg << oendl; QMessageBox::message("Note", "Error opening file.\n" +errorMsg); return false; } else { setWavHeader( track.handle() , &hdr); } return true; } WavFile::~WavFile() { closeFile(); } void WavFile::closeFile() { if(track.isOpen()) track.close(); } int WavFile::openFile(const QString ¤tFileName) { -// qDebug("open play file "+currentFileName); +// odebug << "open play file "+currentFileName << oendl; closeFile(); track.setName(currentFileName); if(!track.open(IO_ReadOnly)) { QString errorMsg=(QString)strerror(errno); - qDebug("<<<<<<<<<<< "+errorMsg+currentFileName); + odebug << "<<<<<<<<<<< "+errorMsg+currentFileName << oendl; QMessageBox::message("Note", "Error opening file.\n" +errorMsg); return -1; } else { parseWavHeader( track.handle()); } return track.handle(); } bool WavFile::setWavHeader(int fd, wavhdr *hdr) { strncpy((*hdr).riffID, "RIFF", 4); // RIFF strncpy((*hdr).wavID, "WAVE", 4); //WAVE strncpy((*hdr).fmtID, "fmt ", 4); // fmt (*hdr).fmtLen = 16; // format length = 16 if( wavFormat == WAVE_FORMAT_PCM) { (*hdr).fmtTag = 1; // PCM -// qDebug("set header WAVE_FORMAT_PCM"); +// odebug << "set header WAVE_FORMAT_PCM" << oendl; } else { (*hdr).fmtTag = WAVE_FORMAT_DVI_ADPCM; //intel ADPCM - // qDebug("set header WAVE_FORMAT_DVI_ADPCM"); + // odebug << "set header WAVE_FORMAT_DVI_ADPCM" << oendl; } // (*hdr).nChannels = 1;//filePara.channels;// ? 2 : 1*/; // channels (*hdr).nChannels = wavChannels;// ? 2 : 1*/; // channels (*hdr).sampleRate = wavSampleRate; //samples per second (*hdr).avgBytesPerSec = (wavSampleRate)*( wavChannels*(wavResolution/8)); // bytes per second (*hdr).nBlockAlign = wavChannels*( wavResolution/8); //block align (*hdr).bitsPerSample = wavResolution; //bits per sample 8, or 16 strncpy((*hdr).dataID, "data", 4); write( fd,hdr, sizeof(*hdr)); qDebug("writing header: bitrate%d, samplerate %d, channels %d", wavResolution, wavSampleRate, wavChannels); return true; } bool WavFile::adjustHeaders(int fd, int total) { lseek(fd, 4, SEEK_SET); int i = total + 36; write( fd, &i, sizeof(i)); lseek( fd, 40, SEEK_SET); write( fd, &total, sizeof(total)); - qDebug("adjusting header %d", total); + odebug << "adjusting header " << total << "" << oendl; return true; } int WavFile::parseWavHeader(int fd) { - qDebug("Parsing wav header"); + odebug << "Parsing wav header" << oendl; char string[4]; int found; short fmt; unsigned short ch, bitrate; unsigned long samplerrate, longdata; if (read(fd, string, 4) < 4) { - qDebug(" Could not read from sound file.\n"); + odebug << " Could not read from sound file.\n" << oendl; return -1; } if (strncmp(string, "RIFF", 4)) { - qDebug(" not a valid WAV file.\n"); + odebug << " not a valid WAV file.\n" << oendl; return -1; } lseek(fd, 4, SEEK_CUR); if (read(fd, string, 4) < 4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } if (strncmp(string, "WAVE", 4)) { - qDebug("not a valid WAV file.\n"); + odebug << "not a valid WAV file.\n" << oendl; return -1; } found = 0; while (!found) { if (read(fd, string, 4) < 4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } if (strncmp(string, "fmt ", 4)) { if (read(fd, &longdata, 4) < 4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } lseek(fd, longdata, SEEK_CUR); } else { lseek(fd, 4, SEEK_CUR); if (read(fd, &fmt, 2) < 2) { - qDebug("Could not read format chunk.\n"); + odebug << "Could not read format chunk.\n" << oendl; return -1; } if (fmt != WAVE_FORMAT_PCM && fmt != WAVE_FORMAT_DVI_ADPCM) { qDebug("Wave file contains unknown format." " Unable to continue.\n"); return -1; } wavFormat = fmt; // compressionFormat=fmt; - qDebug("compressionFormat is %d", fmt); + odebug << "compressionFormat is " << fmt << "" << oendl; if (read(fd, &ch, 2) < 2) { - qDebug("Could not read format chunk.\n"); + odebug << "Could not read format chunk.\n" << oendl; return -1; } else { wavChannels = ch; - qDebug("File has %d channels", ch); + odebug << "File has " << ch << " channels" << oendl; } if (read(fd, &samplerrate, 4) < 4) { - qDebug("Could not read from format chunk.\n"); + odebug << "Could not read from format chunk.\n" << oendl; return -1; } else { wavSampleRate = samplerrate; // sampleRate = samplerrate; - qDebug("File has samplerate of %d",(int) samplerrate); + odebug << "File has samplerate of " << (int) samplerrate << "" << oendl; } lseek(fd, 6, SEEK_CUR); if (read(fd, &bitrate, 2) < 2) { - qDebug("Could not read format chunk.\n"); + odebug << "Could not read format chunk.\n" << oendl; return -1; } else { wavResolution=bitrate; // resolution = bitrate; - qDebug("File has bitrate of %d", bitrate); + odebug << "File has bitrate of " << bitrate << "" << oendl; } found++; } } found = 0; while (!found) { if (read(fd, string, 4) < 4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } if (strncmp(string, "data", 4)) { if (read(fd, &longdata, 4)<4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } lseek(fd, longdata, SEEK_CUR); } else { if (read(fd, &longdata, 4) < 4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } else { wavNumberSamples = longdata; qDebug("file has length of %d \nlasting %d seconds", (int)longdata, (int)(( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)) ); // wavSeconds = (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)); return longdata; } } } lseek(fd, 0, SEEK_SET); return 0; } 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 @@ -6,54 +6,58 @@ ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "waveform.h" -#include <qpainter.h> +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; +/* QT */ +#include <qpainter.h> Waveform::Waveform( QWidget *parent, const char *name, WFlags fl ) : QWidget( parent, name, fl ) { pixmap = 0; windowSize = 100; samplesPerPixel = 8000 / (5 * windowSize); currentValue = 0; numSamples = 0; windowPosn = 0; window = 0; } void Waveform::changeSettings( int frequency, int channels ) { makePixmap(); -// qWarning("change waveform %d, %d", frequency, channels); +// owarn << "change waveform " << frequency << ", " << channels << "" << oendl; samplesPerPixel = frequency * channels / (5 * windowSize); - qWarning("Waveform::changeSettings %d", samplesPerPixel); + owarn << "Waveform::changeSettings " << samplesPerPixel << "" << oendl; if ( !samplesPerPixel ) samplesPerPixel = 1; currentValue = 0; numSamples = 0; windowPosn = 0; draw(); } Waveform::~Waveform() { if ( window ) delete[] window; if ( pixmap ) delete pixmap; } @@ -83,33 +87,33 @@ void Waveform::newSamples( const short *buf, int len ) while ( len > 0 ) { currentValue += *buf++; --len; if ( ++numSamples >= samplesPerPixel ) { window[windowPosn++] = (short)(currentValue / numSamples); if ( windowPosn >= windowSize ) { this->windowPosn = windowPosn; draw(); windowPosn = 0; } numSamples = 0; currentValue = 0; } } // Copy the final state back to the object. -//qWarning("%d, %d, %d", currentValue, numSamples, windowPosn); +//owarn << "" << currentValue << ", " << numSamples << ", " << windowPosn << "" << oendl; this->currentValue = currentValue; this->numSamples = numSamples; this->windowPosn = windowPosn; } void Waveform::makePixmap() { if ( !pixmap ) { pixmap = new QPixmap( size() ); windowSize = pixmap->width(); 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 @@ config POWERCHORD boolean "opie-powerchord (guitar chord generator and tuning)" default "n" - depends ( LIBQPE || LIBQPE-X11 ) - comment "opie-powerchord needs a libqpe" - depends !(( LIBQPE || LIBQPE-X11 ) ) + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE + comment "opie-powerchord needs a libqpe and libopiecore2" + depends !(( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE ) 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 @@ -5,23 +5,22 @@ HEADERS = powerchord.h \ fretboard.h \ chordengine.h \ vumeter.h \ gs.h gt.h \ powerchordbase.h SOURCES = main.cpp \ powerchord.cpp \ fretboard.cpp \ chordengine.cpp \ vumeter.cpp \ gs.cpp gt.cpp \ powerchordbase.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -#INTERFACES = powerchordbase.ui +LIBS += -lqpe -lopiecore2 DESTDIR = $(OPIEDIR)/bin TARGET = powerchord include ( $(OPIEDIR)/include.pro ) 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,38 +1,42 @@ /**************************************************************************** ** Form implementation generated from reading ui file 'powerchordbase.ui' ** ** Created: Sun Jan 13 23:05:11 2002 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #include "powerchordbase.h" - #include "fretboard.h" #include "vumeter.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/resource.h> +using namespace Opie::Core; + +/* QT */ #include <qcombobox.h> #include <qlabel.h> #include <qlistbox.h> #include <qpushbutton.h> #include <qspinbox.h> #include <qtabwidget.h> #include <qlayout.h> #include <qtooltip.h> -#include <qpe/resource.h> - /* * Constructs a PowerchordBase which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ PowerchordBase::PowerchordBase( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { simulation_timer = 0; audio_timer = 0; // setPalette( QPalette( QColor( 232, 227, 215) ) ); // QPixmap image0(QString("/opt/Qtopia/pics/powerchord/image0")); QPixmap image1 = Resource::loadPixmap( "powerchord/image1"); QPixmap image2 = Resource::loadPixmap( "powerchord/image2"); @@ -567,19 +571,19 @@ void PowerchordBase::tuner_simulation_cb(){ tuner_pic1->setPixmap( image6 ); }else{ emit frequency_change(simulation_x); } } /* * Destroys the object and frees any allocated resources */ PowerchordBase::~PowerchordBase() { // no need to delete child widgets, Qt does it all for us } void PowerchordBase::change_handler() { - qWarning( "PowerchordBase::change_handler(): Not implemented yet!" ); + owarn << "PowerchordBase::change_handler(): Not implemented yet!" << oendl; } 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,27 +1,29 @@ +#include "ImageFileSelector.h" +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/qpeapplication.h> +using namespace Opie::Core; -#include "qpe/qpeapplication.h" - -#include <stdlib.h> - +/* QT */ #include <qlabel.h> #include <qfileinfo.h> -#include "ImageFileSelector.h" - +/* STD */ +#include <stdlib.h> ThumbWidget::ThumbWidget(QPixmap p,QString text,const DocLnk& f,QWidget *parent,int w) : QWidget( parent ),fl(f) { setBackgroundMode(NoBackground); if ( w!=-1 ) setMinimumSize(w,p.height()+24); else setMinimumSize(p.width(),p.height()+24); description=new QLabel(text,this); description->setBackgroundColor(colorGroup().base()); description->setAlignment(AlignCenter); description->setGeometry(0,height()-24,width(),24); pixmap=p; } @@ -142,33 +144,33 @@ void ImageFileSelector::resizeEvent(QResizeEvent *) { updateSizes(); } void ImageFileSelector::updateSizes() { int ww=(detailed->width()-detailed->frameWidth()*2); double w=(double)ww*0.70; detailed->setColumnWidth(0,(int)w); detailed->setColumnWidth(1,ww-(int)w); background->setMinimumWidth(thumb->visibleWidth()); thumb->updateScrollBars(); } void ImageFileSelector::reread(bool) { -// qDebug("reread"); +// odebug << "reread" << oendl; ImageFileSelectorItem *item = (ImageFileSelectorItem *)detailed->selectedItem(); QString oldFile; if ( item ) oldFile = item->file().file(); detailed->clear(); tList.clear(); DocLnkSet files; Global::findDocuments(&files, "image/*"); count = files.children().count(); QListIterator<DocLnk> dit( files.children() ); // int y=0; // int x=4; // int totalHeight=4; ThumbWidget *l=0; int width=80; gl->expand(dit.count()/2,2); @@ -208,33 +210,33 @@ void ImageFileSelector::reread(bool) if ( !detailed->selectedItem() ) detailed->setCurrentItem( detailed->firstChild() ); detailed->setUpdatesEnabled(true); thumb->setUpdatesEnabled(true); detailed->update(); thumb->update(); } int ImageFileSelector::fileCount() { return count; } const DocLnk * ImageFileSelector::selected() { - qDebug("image selected"); + odebug << "image selected" << oendl; ImageFileSelectorItem *item = (ImageFileSelectorItem *) detailed->selectedItem(); if ( item ) return new DocLnk( item->file() ); return 0; } void ImageFileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, int ) { if ( !i ) return; if ( button == Qt::LeftButton ) { fileClicked( i ); } 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 @@ -13,49 +13,51 @@ ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ // // Full-screen and rotation options contributed by Robert Wittams <robert@wittams.com> // #include "showimg.h" #include "ImageFileSelector.h" #include "settingsdialog.h" - +/* OPIE */ +#include <opie2/odebug.h> #include <opie2/ofiledialog.h> - #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/resource.h> -#include <qtoolbar.h> +using namespace Opie::Core; +using namespace Opie::Ui; +/* QT */ +#include <qtoolbar.h> #include <qaction.h> #include <qfiledialog.h> #include <qmenubar.h> #include <qspinbox.h> +/* STD */ #include <math.h> - -using namespace Opie::Ui; ControlsDialog::ControlsDialog(const QString &caption,QImage image,int *brightness,QWidget *parent) : QDialog(parent,0,true) { setCaption(caption); if ( parent ) { setPalette(parent->palette()); } b=brightness; img=image; setMinimumSize(140,80); QGridLayout *gl= new QGridLayout(this,2,2,4,4); @@ -273,33 +275,33 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int /*wFlags*/ ) stack = new QWidgetStack( this ); stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); setCentralWidget( stack ); imagePanel = new ImagePane( stack ); connect(imagePanel, SIGNAL(clicked()), this, SLOT(normalView())); ImageFileSelector::CURRENT_VIEW cv; if(showThumbView) cv=ImageFileSelector::THUMBNAIL; else cv=ImageFileSelector::DETAILED; - qDebug("cv = %d",cv); + odebug << "cv = " << cv << "" << oendl; fileSelector = new ImageFileSelector( cv,stack, "fs"); //switchThumbView(); //fileSelector = new ImageFileSelector("image/*", stack, "fs"); //fileSelector->setNewVisible(FALSE); //fileSelector->setCloseVisible(FALSE); connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( closeFileSelector() ) ); connect( fileSelector, SIGNAL( fileSelected(const DocLnk&) ), this, SLOT( openFile(const DocLnk&) ) ); imageList = fileSelector->fileList(); slideAction->setEnabled( imageList.count() != 0); @@ -400,33 +402,33 @@ ImageViewer::~ImageViewer() void ImageViewer::help() { } void ImageViewer::settings() { SettingsDialog dlg( this, 0, TRUE ); dlg.setDelay( slideDelay ); dlg.setRepeat( slideRepeat ); dlg.setReverse( slideReverse ); dlg.setRotate(rotateOnLoad); dlg.setFastLoad(fastLoad); if ( QPEApplication::execDialog(&dlg) == QDialog::Accepted ) { - qDebug("<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>"); + odebug << "<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>" << oendl; slideDelay = dlg.delay(); slideRepeat = dlg.repeat(); slideReverse = dlg.reverse(); rotateOnLoad = dlg.rotate(); fastLoad = dlg.fastLoad(); Config config( "ImageViewer" ); config.setGroup( "SlideShow" ); config.writeEntry( "Delay", slideDelay ); config.writeEntry( "Repeat", slideRepeat ); config.writeEntry("Reverse", slideReverse); config.setGroup("Default"); config.writeEntry("Rotate", rotateOnLoad); config.writeEntry("FastLoad", fastLoad); } @@ -492,63 +494,63 @@ void ImageViewer::setDocument(const QString& fileref) QTimer::singleShot( 0, this, SLOT(doDelayedLoad()) ); } void ImageViewer::doDelayedLoad() { show(delayLoad); } void ImageViewer::show() { normalView(); QMainWindow::show(); } void ImageViewer::show(const QString& fileref) { -// qDebug("Show "+fileref); +// odebug << "Show "+fileref << oendl; bFromDocView = TRUE; closeFileSelector(); DocLnk link(fileref); if ( link.isValid() ) { openFile(link); } else { filename = fileref; updateCaption( fileref ); loadImage( fileref ); } } void ImageViewer::openFile() { MimeTypes types; QStringList image; image << "image/*"; types.insert("Images", image); QString str = OFileDialog::getOpenFileName( 1,QPEApplication::documentDir(),"", types, 0 ); DocLnk link(str); // if ( link.isValid() ) openFile(link); } void ImageViewer::openFile( const DocLnk &link ) { closeFileSelector(); // DocLnk link(file); - qDebug("open "+link.name()); + odebug << "open "+link.name() << oendl; updateCaption( link.name() ); loadImage( link.file() ); if (slideTimer->isActive()) { slideTimer->start(slideDelay * 1000, FALSE); } } void ImageViewer::open() { switchToFileSelector(); } void ImageViewer::closeFileSelector() { switchToImageView(); 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 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 @@ config TONLEITER boolean "tonleiter (shows scales on sting instruments)" default "n" - depends ( LIBQPE || LIBQPE-X11 ) + 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,21 +1,26 @@ #include "editinst.h" -#include <qpushbutton.h> - +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/config.h> #include <qpe/qpeapplication.h> +using namespace Opie::Core; + +/* QT */ +#include <qpushbutton.h> Menu::InstEditDialog::InstEditDialog(TonleiterData* data,QWidget* parent,const char* name) :QDialog(parent,name,true,0),data(data) { setCaption("Tonleiter::"+tr("Instrument")); QBoxLayout* masterlayout=new QBoxLayout(this,QBoxLayout::TopToBottom); instid=data->getCurrentInstrumentID(); stringlist.setAutoDelete(true); QBoxLayout* toplayout=new QBoxLayout(masterlayout,QBoxLayout::LeftToRight); //Name combo + Add + Delete boxInst=new QComboBox(this,"boxInst"); boxInst->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); connect(boxInst,SIGNAL(activated(int)),this,SLOT(setCurrentInstrumetID(int))); for(int i=0;i<data->noOfInstruments();i++) @@ -87,24 +92,24 @@ void Menu::InstEditDialog::addHighString() } //**************************************************************************** void Menu::InstEditDialog::deleteString(int id) { } //**************************************************************************** void Menu::InstEditDialog::saveInstrument() { //auto delete is set to true so widgets _should_ be deleted stringlist.clear(); } //**************************************************************************** void Menu::InstEditDialog::loadInstrument() { stringlist.clear(); Instrument inst=data->getInstrument(instid); - qDebug("load Instrument : %d strings",inst.noOfStrings()); + odebug << "load Instrument : " << inst.noOfStrings() << " strings" << oendl; for(uint s=0;s<inst.noOfStrings();s++) { stringlist.append(new EditStringWidget(inst.string(s),stringwidget)); } } //**************************************************************************** //**************************************************************************** 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,46 +1,51 @@ #include "fretboard.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qpainter.h> Graph::FretBoard::FretBoard(TonleiterData* data,QWidget* parent,const char* name,WFlags f) :QWidget(parent,name,f),data(data) { setBackgroundColor(QColor(0,0,0)); fretpen=QPen(QColor(155,155,155),0); markerbrush=QBrush(QColor(155,155,155)); stringpen=QPen(QColor(255,255,255),3); connect(data,SIGNAL(dataChange()),this,SLOT(dataChange())); } //**************************************************************************** Graph::FretBoard::~FretBoard() { } //**************************************************************************** void Graph::FretBoard::dataChange() { repaint(true); } //**************************************************************************** void Graph::FretBoard::paintEvent(QPaintEvent* pe) { Q_UNUSED(pe); int instid=data->getCurrentInstrumentID(); inst=data->getInstrument(instid); - //qDebug("inst %d is %s",instid,inst.instName().data()); + //odebug << "inst " << instid << " is " << inst.instName().data() << "" << oendl; QRect mysize=rect(); xmargin=(int)(mysize.width()*0.05); xmin=2*xmargin; xmax=mysize.width()-xmargin; xwidth=xmax-xmin; ymargin=(int)(mysize.height()*0.1); ymin=ymargin; ymax=mysize.height()-2*ymargin; yheight=ymax-ymin; QPainter p(this); paintBoard(&p); paintFrets(&p); @@ -130,43 +135,43 @@ void Graph::FretBoard::paintScale(QPainter* p) int baseoctave=Note::octaveOfBaseNote(data->getCurrentBaseNote(),inst.lowestNote()); for(int s=0;s<inst.noOfStrings();s++) { int y=(int)(stringdist*s)+ymin; int stingid=inst.noOfStrings()-(s+1); for(int f=0;f<=inst.noOfFrets();f++) { int note=inst.string(stingid)+f; if(scale.noteInScale(data->getCurrentBaseNote(),note)) { int x=(int)(fretdist*f)+xmin; //no more than six octaves can be visualised (there is a zero octave) int octave=Note::octaveOfBaseNote(data->getCurrentBaseNote(),note)-baseoctave; if(octave<0) - qDebug("%d,%d",octave,baseoctave); + odebug << "" << octave << "," << baseoctave << "" << oendl; if(octave>5) { - qDebug("octave out of range"); + odebug << "octave out of range" << oendl; octave=5; } p->setPen(QColor(255,0,0)); int c= ( (note-12*baseoctave) - (12*octave+data->getCurrentBaseNote()) )*15; if(c<0 || c>255) - qDebug("%d = %d - ( %d + %d)",c,note,12*octave,data->getCurrentBaseNote()); + odebug << "" << c << " = " << note << " - ( " << 12*octave << " + " << data->getCurrentBaseNote() << ")" << oendl; QColor dotcolor(255,255,255); if(octave==0) dotcolor=QColor(c,c,255); else if(octave==1) dotcolor=QColor(c,255,c); else if(octave==2) dotcolor=QColor(255,c,c); else if(octave==3) dotcolor=QColor(255,255,c); else if(octave==4) dotcolor=QColor(255,c,255); else dotcolor=QColor(c,255,255); p->setBrush(dotcolor); 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 @@ TEMPLATE = app -#CONFIG = qt warn_on CONFIG = qt warn_on HEADERS = mainwidget.h tonleiterdata.h tonleiterdatahelper.h fretboard.h menuwidget.h editinst.h editstringwidget.h editscale.h pianoscale.h SOURCES = mainwidget.cpp tonleiterdata.cpp tonleiterdatahelper.cpp fretboard.cpp menuwidget.cpp main.cpp editinst.cpp editstringwidget.cpp editscale.cpp pianoscale.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -INTERFACES = +LIBS += -lqpe -lopiecore2 TARGET = tonleiter DESTDIR = $(OPIEDIR)/bin -#TMAKE_CXXFLAGS += -DQT_QWS_VERCEL_IDR -DQWS -fno-exceptions -fno-rtti + include ( $(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,22 +1,23 @@ #include "tonleiterdata.h" - -#include <qpe/config.h> - using namespace Data; +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/config.h> +using namespace Opie::Core; TonleiterData::TonleiterData(QObject* parent) :QObject(parent) { drawnames=true; loadData(); } //**************************************************************************** TonleiterData::~TonleiterData() { saveData(); } //**************************************************************************** void TonleiterData::setCurrentInstrumetID(int id) { if(id>=0 && id<noOfInstruments()) @@ -139,55 +140,55 @@ void TonleiterData::saveData() scalelist.append(QString::number(scale.getHalfTone(ht))); save.writeEntry("Scale"+QString::number(s),scalelist,';'); } } //**************************************************************************** int TonleiterData::noOfInstruments() { return (int)instruments.count(); } //**************************************************************************** Instrument TonleiterData::getInstrument(int id) { if(id>=0 && id<noOfInstruments()) return instruments[id]; else { - qDebug("undefined insrtument %d of %d",id,instruments.count()); + odebug << "undefined insrtument " << id << " of " << instruments.count() << "" << oendl; return Instrument(); } } //**************************************************************************** int TonleiterData::getCurrentInstrumentID() { return currentInstrumentID; } //**************************************************************************** int TonleiterData::noOfScales() { return (int)scales.count(); } //**************************************************************************** Scale TonleiterData::getScale(int id) { if(id>=0 && id<noOfScales()) return scales[id]; else { - qDebug("Undefined scale"); + odebug << "Undefined scale" << oendl; return Scale(); } } //**************************************************************************** int TonleiterData::getCurrentScaleID() { return currentScaleID; } //**************************************************************************** int TonleiterData::getCurrentBaseNote() { return currentNote; } //**************************************************************************** bool TonleiterData::isDrawNames() { 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 @@ -21,33 +21,33 @@ int Note::getNoteFromName(QString name,int octave) int notevalue=0; for(int a=0;a<12;a++) { if(name==notenames[a]) { notevalue=a; break; } } return notevalue+12*octave; } //**************************************************************************** int Note::octaveOfBaseNote(int base,int note) { int normnote = (note>=base) ? note-base : (12-base)+note; int octave=getOctaveOfNote(normnote); - //qDebug("note %d of %d base is norm %d -> ocatve %d",note,base,normnote,octave); + //odebug << "note " << note << " of " << base << " base is norm " << normnote << " -> ocatve " << octave << "" << oendl; return octave; } //**************************************************************************** //**************************************************************************** Instrument::Instrument() { name="UNDEFINED"; frets=0; } //**************************************************************************** Instrument::Instrument(QString name,int frets,QValueList<int> strings) :name(name),frets(frets),strings(strings) { } //**************************************************************************** Instrument::~Instrument() @@ -118,27 +118,27 @@ int Scale::getHalfTone(int id) return 0; } //**************************************************************************** QString Scale::scaleName() { return name; } //**************************************************************************** bool Scale::noteInScale(int base,int note) { int octave=Note::getOctaveOfNote(note); note-=12*octave; int normnote = (note>=base) ? note-base : (12-base)+note; if(halftones.contains(normnote)>0) { - //qDebug("OK : base : %d, note %d -> norm %d",base,note,normnote); + //odebug << "OK : base : " << base << ", note " << note << " -> norm " << normnote << "" << oendl; return true; } else { - //qDebug("BAD : base : %d, note %d -> norm %d",base,note,normnote); + //odebug << "BAD : base : " << base << ", note " << note << " -> norm " << normnote << "" << oendl; return false; } } //**************************************************************************** //**************************************************************************** |