diff -urN mediatagtools-0.3.2/src/mttmainwin.cpp mediatagtools-0.3.2-patch/src/mttmainwin.cpp --- mediatagtools-0.3.2/src/mttmainwin.cpp 2007-03-06 00:54:38.000000000 +0100 +++ mediatagtools-0.3.2-patch/src/mttmainwin.cpp 2007-07-28 13:56:22.000000000 +0200 @@ -600,11 +600,18 @@ QApplication::setOverrideCursor( QCursor( Qt::waitCursor ) ); ignoreChange = true; // It's needed because otherwise all the files would have this tag - GenTitleCLE->setText( GenTitleCLE->text().upper() ); - GenArtistCLE->setText( GenArtistCLE->text().upper() ); - GenAlbumCLE->setText( GenAlbumCLE->text().upper() ); - GenGenreCB->setCurrentText( GenGenreCB->currentText().upper() ); - GenCommentCLE->setText( GenCommentCLE->text().upper() ); + if( GenTitleChkB->isChecked() ) { + GenTitleCLE->setText( GenTitleCLE->text().upper() ); + } + if( GenArtistChkB->isChecked() ) { + GenArtistCLE->setText( GenArtistCLE->text().upper() ); + } + if( GenAlbumChkB->isChecked() ) { + GenAlbumCLE->setText( GenAlbumCLE->text().upper() ); + } + if( GenCommentChkB->isChecked() ) { + GenCommentCLE->setText( GenCommentCLE->text().upper() ); + } ignoreChange = false; while( it.current() ) { @@ -613,16 +620,26 @@ // Show tag info t = (( AListViewItem *) it.current() )->getTag(); if ( t ) { - t->setTitle( QStringToTString( TStringToQString( t->title() ).upper() ) ); - it.current()->setText( 1, TStringToQString( t->title() ) ); - t->setArtist( QStringToTString( TStringToQString( t->artist() ).upper() ) ); - it.current()->setText( 2, TStringToQString( t->artist() ) ); - t->setAlbum( QStringToTString( TStringToQString( t->album() ).upper() ) ); - it.current()->setText( 3, TStringToQString( t->album() ) ); - t->setGenre( QStringToTString( TStringToQString( t->genre() ).upper() ) ); - it.current()->setText( 5, TStringToQString( t->genre() ) ); - t->setComment( QStringToTString( TStringToQString( t->comment() ).upper() ) ); - it.current()->setText( 6, TStringToQString( t->comment() ) ); + if( GenTitleChkB->isChecked() ) { + t->setTitle( QStringToTString( TStringToQString( t->title() ).upper() ) ); + it.current()->setText( 1, TStringToQString( t->title() ) ); + } + + if( GenArtistChkB->isChecked() ) { + t->setArtist( QStringToTString( TStringToQString( t->artist() ).upper() ) ); + it.current()->setText( 2, TStringToQString( t->artist() ) ); + } + + if( GenAlbumChkB->isChecked() ) { + t->setAlbum( QStringToTString( TStringToQString( t->album() ).upper() ) ); + it.current()->setText( 3, TStringToQString( t->album() ) ); + } + + if( GenCommentChkB->isChecked() ) { + t->setComment( QStringToTString( TStringToQString( t->comment() ).upper() ) ); + it.current()->setText( 6, TStringToQString( t->comment() ) ); + } + ( (AListViewItem *) it.current() )->setTagChanged( true ); } ++it; @@ -638,29 +655,100 @@ QApplication::setOverrideCursor( QCursor( Qt::waitCursor ) ); ignoreChange = true; // It's needed because otherwise all the files would have this tag - GenTitleCLE->setText( GenTitleCLE->text().lower() ); - GenArtistCLE->setText( GenArtistCLE->text().lower() ); - GenAlbumCLE->setText( GenAlbumCLE->text().lower() ); - GenGenreCB->setCurrentText( GenGenreCB->currentText().lower() ); - GenCommentCLE->setText( GenCommentCLE->text().lower() ); + if( GenTitleChkB->isChecked() ) { + GenTitleCLE->setText( GenTitleCLE->text().lower() ); + } + if( GenArtistChkB->isChecked() ) { + GenArtistCLE->setText( GenArtistCLE->text().lower() ); + } + if( GenAlbumChkB->isChecked() ) { + GenAlbumCLE->setText( GenAlbumCLE->text().lower() ); + } + if( GenCommentChkB->isChecked() ) { + GenCommentCLE->setText( GenCommentCLE->text().lower() ); + } + ignoreChange = false; + + while( it.current() ) { + TagLib::Tag *t; + + // Show tag info + t = (( AListViewItem *) it.current() )->getTag(); + if ( t ) { + if( GenTitleChkB->isChecked() ) { + t->setTitle( QStringToTString( TStringToQString( t->title() ).lower() ) ); + it.current()->setText( 1, TStringToQString( t->title() ) ); + } + + if( GenArtistChkB->isChecked() ) { + t->setArtist( QStringToTString( TStringToQString( t->artist() ).lower() ) ); + it.current()->setText( 2, TStringToQString( t->artist() ) ); + } + + if( GenAlbumChkB->isChecked() ) { + t->setAlbum( QStringToTString( TStringToQString( t->album() ).lower() ) ); + it.current()->setText( 3, TStringToQString( t->album() ) ); + } + + if( GenCommentChkB->isChecked() ) { + t->setComment( QStringToTString( TStringToQString( t->comment() ).lower() ) ); + it.current()->setText( 6, TStringToQString( t->comment() ) ); + } + + ( (AListViewItem *) it.current() )->setTagChanged( true ); + } + ++it; + } + + QApplication::restoreOverrideCursor(); +} + +void mttMainWin::slotFirstUpWords() +{ + QListViewItemIterator it( GenListView, QListViewItemIterator::Selected ); + + ignoreChange = true; // It's needed because otherwise all the files would have this tag + if( GenTitleChkB->isChecked() ) { + GenTitleCLE->setText( firstUp( GenTitleCLE->text().lower() ) ); + } + if( GenArtistChkB->isChecked() ) { + GenArtistCLE->setText( firstUp( GenArtistCLE->text().lower() ) ); + } + if( GenAlbumChkB->isChecked() ) { + GenAlbumCLE->setText( firstUp( GenAlbumCLE->text().lower() ) ); + } + if( GenCommentChkB->isChecked() ) { + GenCommentCLE->setText( firstUp( GenCommentCLE->text().lower() ) ); + } ignoreChange = false; + QApplication::setOverrideCursor( QCursor( Qt::waitCursor ) ); while( it.current() ) { TagLib::Tag *t; // Show tag info t = (( AListViewItem *) it.current() )->getTag(); if ( t ) { - t->setTitle( QStringToTString( TStringToQString( t->title() ).lower() ) ); - it.current()->setText( 1, TStringToQString( t->title() ) ); - t->setArtist( QStringToTString( TStringToQString( t->artist() ).lower() ) ); - it.current()->setText( 2, TStringToQString( t->artist() ) ); - t->setAlbum( QStringToTString( TStringToQString( t->album() ).lower() ) ); - it.current()->setText( 3, TStringToQString( t->album() ) ); - t->setGenre( QStringToTString( TStringToQString( t->genre() ).lower() ) ); - it.current()->setText( 5, TStringToQString( t->genre() ) ); - t->setComment( QStringToTString( TStringToQString( t->comment() ).lower() ) ); - it.current()->setText( 6, TStringToQString( t->comment() ) ); + if( GenTitleChkB->isChecked() ) { + t->setTitle( QStringToTString( firstUp( TStringToQString( t->title() ).lower() ) ) ); + it.current()->setText( 1, TStringToQString( t->title() ) ); + } + + if( GenArtistChkB->isChecked() ) { + t->setArtist( QStringToTString( firstUp( TStringToQString( t->artist() ).lower() ) ) ); + it.current()->setText( 2, TStringToQString( t->artist() ) ); + } + + if( GenAlbumChkB->isChecked() ) { + t->setAlbum( QStringToTString( firstUp( TStringToQString( t->album() ).lower() ) ) ); + it.current()->setText( 3, TStringToQString( t->album() ) ); + } + + if( GenCommentChkB->isChecked() ) { + t->setComment( QStringToTString( firstUp( TStringToQString( t->comment() ).lower() ) ) ); + it.current()->setText( 6, TStringToQString( t->comment() ) ); + } + ( (AListViewItem *) it.current() )->setTagChanged( true ); } ++it; @@ -669,16 +757,23 @@ QApplication::restoreOverrideCursor(); } -void mttMainWin::slotFirstUp() +void mttMainWin::slotFirstUpSentence() // Here is the change to get only the first letter uppercase (only track name) { QListViewItemIterator it( GenListView, QListViewItemIterator::Selected ); ignoreChange = true; // It's needed because otherwise all the files would have this tag - GenTitleCLE->setText( firstUp( GenTitleCLE->text().lower() ) ); - GenArtistCLE->setText( firstUp( GenArtistCLE->text().lower() ) ); - GenAlbumCLE->setText( firstUp( GenAlbumCLE->text().lower() ) ); - GenGenreCB->setCurrentText( firstUp( GenGenreCB->currentText().lower() ) ); - GenCommentCLE->setText( firstUp( GenCommentCLE->text().lower() ) ); + if( GenTitleChkB->isChecked() ) { + GenTitleCLE->setText( firstUpSentence( GenTitleCLE->text().lower() ) ); + } + if( GenArtistChkB->isChecked() ) { + GenArtistCLE->setText( firstUpSentence( GenArtistCLE->text().lower() ) ); + } + if( GenAlbumChkB->isChecked() ) { + GenAlbumCLE->setText( firstUpSentence( GenAlbumCLE->text().lower() ) ); + } + if( GenCommentChkB->isChecked() ) { + GenCommentCLE->setText( firstUpSentence( GenCommentCLE->text().lower() ) ); + } ignoreChange = false; QApplication::setOverrideCursor( QCursor( Qt::waitCursor ) ); @@ -688,16 +783,26 @@ // Show tag info t = (( AListViewItem *) it.current() )->getTag(); if ( t ) { - t->setTitle( QStringToTString( firstUp( TStringToQString( t->title() ).lower() ) ) ); - it.current()->setText( 1, TStringToQString( t->title() ) ); - t->setArtist( QStringToTString( firstUp( TStringToQString( t->artist() ).lower() ) ) ); - it.current()->setText( 2, TStringToQString( t->artist() ) ); - t->setAlbum( QStringToTString( firstUp( TStringToQString( t->album() ).lower() ) ) ); - it.current()->setText( 3, TStringToQString( t->album() ) ); - t->setGenre( QStringToTString( firstUp( TStringToQString( t->genre() ).lower() ) ) ); - it.current()->setText( 5, TStringToQString( t->genre() ) ); - t->setComment( QStringToTString( firstUp( TStringToQString( t->comment() ).lower() ) ) ); - it.current()->setText( 6, TStringToQString( t->comment() ) ); + if( GenTitleChkB->isChecked() ) { + t->setTitle( QStringToTString( firstUpSentence( TStringToQString( t->title() ).lower() ) ) ); + it.current()->setText( 1, TStringToQString( t->title() ) ); + } + + if( GenArtistChkB->isChecked() ) { + t->setArtist( QStringToTString( firstUpSentence( TStringToQString( t->artist() ).lower() ) ) ); + it.current()->setText( 2, TStringToQString( t->artist() ) ); + } + + if( GenAlbumChkB->isChecked() ) { + t->setAlbum( QStringToTString( firstUpSentence( TStringToQString( t->album() ).lower() ) ) ); + it.current()->setText( 3, TStringToQString( t->album() ) ); + } + + if( GenCommentChkB->isChecked() ) { + t->setComment( QStringToTString( firstUpSentence( TStringToQString( t->comment() ).lower() ) ) ); + it.current()->setText( 6, TStringToQString( t->comment() ) ); + } + ( (AListViewItem *) it.current() )->setTagChanged( true ); } ++it; @@ -706,6 +811,7 @@ QApplication::restoreOverrideCursor(); } + void mttMainWin::slotEmptyFields() { GenTitleCLE->clear(); @@ -717,6 +823,15 @@ GenTrackCLE->clear(); } +QString mttMainWin::firstUpSentence( QString str ) +{ + if ( str[0].isLetter() ) { + str[0] = str[0].upper(); + } + + return str; +} + QString mttMainWin::firstUp( QString str ) { unsigned int i; @@ -739,7 +854,8 @@ { QPopupMenu menu, corCaseMenu; - corCaseMenu.insertItem( tr( "First letter up" ), this, SLOT(slotFirstUp()) ); + corCaseMenu.insertItem( tr( "First letter up (first word)" ), this, SLOT(slotFirstUpSentence()) ); + corCaseMenu.insertItem( tr( "First letter up (each word)" ), this, SLOT(slotFirstUpWords()) ); corCaseMenu.insertItem( tr( "All uppercase" ), this, SLOT(slotAllUpper()) ); corCaseMenu.insertItem( tr( "All lowercase" ), this, SLOT(slotAllLower()) ); diff -urN mediatagtools-0.3.2/src/mttmainwin.h mediatagtools-0.3.2-patch/src/mttmainwin.h --- mediatagtools-0.3.2/src/mttmainwin.h 2007-03-06 00:54:38.000000000 +0100 +++ mediatagtools-0.3.2-patch/src/mttmainwin.h 2007-07-28 12:17:00.000000000 +0200 @@ -46,6 +46,7 @@ void populateList( QDir d ); QString firstUp( QString ); + QString firstUpSentence( QString ); bool isTextFrame( QString ); void saveTags( bool selectedOnly = false ); @@ -60,7 +61,8 @@ virtual void slotRenameFiles(); virtual void slotAbout(); virtual void slotCorrectCase(); - virtual void slotFirstUp(); + virtual void slotFirstUpSentence(); + virtual void slotFirstUpWords(); virtual void slotAllUpper(); virtual void slotAllLower(); virtual void slotEmptyFields();