You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
730 lines
26 KiB
730 lines
26 KiB
15 years ago
|
|
||
|
#include "optionseditor.h"
|
||
|
#include "options.h"
|
||
|
#include "tagengine.h"
|
||
|
#include "filelist.h"
|
||
|
#include "conversionoptions.h"
|
||
|
#include "outputdirectory.h"
|
||
|
|
||
|
#include <qlayout.h>
|
||
|
#include <qstring.h>
|
||
|
#include <qlabel.h>
|
||
|
#include <qdatetime.h>
|
||
|
|
||
|
#include <klocale.h>
|
||
|
#include <kiconloader.h>
|
||
|
#include <kpushbutton.h>
|
||
|
//#include <kmessagebox.h>
|
||
|
#include <klineedit.h>
|
||
|
#include <kcombobox.h>
|
||
|
#include <knuminput.h>
|
||
|
#include <ktextedit.h>
|
||
|
|
||
|
// TODO add warning, when editing tags and converting to an unsupported file format
|
||
|
|
||
|
OptionsEditor::OptionsEditor( TagEngine* _tagEngine, Config* _config, FileList* _fileList, QWidget* parent, const char* name, Page startPage )
|
||
|
: KDialogBase(
|
||
|
IconList,
|
||
|
i18n("Options Editor"),
|
||
|
/*User2 | User1 |*/ Ok,
|
||
|
Ok, // default button
|
||
|
parent,
|
||
|
name,
|
||
|
false, // modal
|
||
|
true/*, // separator
|
||
|
i18n("Next"),
|
||
|
i18n("Previous")*/
|
||
|
)
|
||
|
{
|
||
|
fileList = _fileList;
|
||
|
config = _config;
|
||
|
tagEngine = _tagEngine;
|
||
|
|
||
|
// create an icon loader object for loading icons
|
||
|
KIconLoader* iconLoader = new KIconLoader();
|
||
|
|
||
|
resize( 400, 350 );
|
||
|
// TODO move the dialog beside the main window
|
||
|
setIcon( iconLoader->loadIcon("view_text",KIcon::Small) );
|
||
|
|
||
|
// setButtonGuiItem( User2, KGuiItem(i18n("Previous"),iconLoader->loadIconSet("previous",KIcon::Small,16,true/*KDE3.5,false*/)) );
|
||
|
// setButtonGuiItem( User1, KGuiItem(i18n("Next"),iconLoader->loadIconSet("next",KIcon::Small,16,true/*KDE3.5,false*/)) );
|
||
|
setButtonGuiItem( Ok, KGuiItem(i18n("Close"),iconLoader->loadIconSet("exit",KIcon::Small,16,true/*KDE3.5,false*/)) );
|
||
|
|
||
|
//// options page ////
|
||
|
conversionOptions = addPage( i18n("Conversion"), i18n("Conversion options"), iconLoader->loadIcon("soundkonverter",KIcon::Desktop) );
|
||
|
// the grid for all widgets in the main window
|
||
|
QGridLayout* conversionOptionsGridLayout = new QGridLayout( conversionOptions, 1, 1, 0, 6, "conversionOptionsGridLayout" );
|
||
|
// generate the options input area
|
||
|
options = new Options( config, i18n("Choose your prefered output options and click on \"Close\"!"), conversionOptions, "options" );
|
||
|
conversionOptionsGridLayout->addWidget( options, 0, 0 );
|
||
|
connect( options, SIGNAL(optionsChanged()),
|
||
|
this, SLOT(optionsChanged())
|
||
|
);
|
||
|
conversionOptionsGridLayout->setRowStretch( 1, 1 );
|
||
|
|
||
|
lEditOptions = new QLabel( "", conversionOptions, "lEditOptions" );
|
||
|
conversionOptionsGridLayout->addWidget( lEditOptions, 2, 0 );
|
||
|
lEditOptions->setAlignment( Qt::AlignHCenter );
|
||
|
lEditOptions->hide();
|
||
|
pEditOptions = new KPushButton( i18n("Edit conversion options"), conversionOptions, "pEditOptions" );
|
||
|
pEditOptions->setFixedWidth( pEditOptions->sizeHint().width() );
|
||
|
conversionOptionsGridLayout->addWidget( pEditOptions, 3, 0, Qt::AlignHCenter );
|
||
|
pEditOptions->hide();
|
||
|
connect( pEditOptions, SIGNAL(clicked()),
|
||
|
this, SLOT(editOptionsClicked())
|
||
|
);
|
||
|
|
||
|
//// tags page ////
|
||
|
tags = addPage( i18n("Tags"), i18n("Tags"), iconLoader->loadIcon("view_text",KIcon::Desktop) );
|
||
|
// the grid for all widgets in the main window
|
||
|
QGridLayout* tagsGridLayout = new QGridLayout( tags, 1, 1, 0, 6, "tagsGridLayout" );
|
||
|
|
||
|
// add the inputs
|
||
|
// add a horizontal box layout for the title and track number
|
||
|
QHBoxLayout *titleBox = new QHBoxLayout( -1, "titleBox" );
|
||
|
tagsGridLayout->addLayout( titleBox, 0, 1 );
|
||
|
// and fill it up
|
||
|
lTitleLabel = new QLabel( i18n("Title:"), tags, "lTitleLabel" );
|
||
|
tagsGridLayout->addWidget( lTitleLabel, 0, 0 );
|
||
|
lTitle = new KLineEdit( tags, "lTitle" );
|
||
|
titleBox->addWidget( lTitle );
|
||
|
connect( lTitle, SIGNAL(textChanged(const QString&)),
|
||
|
this, SLOT(titleChanged(const QString&))
|
||
|
);
|
||
|
pTitleEdit = new KPushButton( " ", tags, "pTitleEdit" );
|
||
|
pTitleEdit->setPixmap( iconLoader->loadIcon("kwrite",KIcon::Small) );
|
||
|
pTitleEdit->setFixedSize( lTitle->sizeHint().height(), lTitle->sizeHint().height() );
|
||
|
pTitleEdit->hide();
|
||
|
titleBox->addWidget( pTitleEdit );
|
||
|
connect( pTitleEdit, SIGNAL(clicked()),
|
||
|
this, SLOT(editTitleClicked())
|
||
|
);
|
||
|
lNumberLabel = new QLabel( i18n("Track No.:"), tags, "lNumberLabel" );
|
||
|
titleBox->addWidget( lNumberLabel );
|
||
|
iNumber = new KIntSpinBox( 0, 999, 1, 1, 10, tags, "iNumber" );
|
||
|
titleBox->addWidget( iNumber );
|
||
|
connect( iNumber, SIGNAL(valueChanged(int)),
|
||
|
this, SLOT(numberChanged(int))
|
||
|
);
|
||
|
pNumberEdit = new KPushButton( " ", tags, "pNumberEdit" );
|
||
|
pNumberEdit->setPixmap( iconLoader->loadIcon("kwrite",KIcon::Small) );
|
||
|
pNumberEdit->setFixedSize( iNumber->sizeHint().height(), iNumber->sizeHint().height() );
|
||
|
pNumberEdit->hide();
|
||
|
titleBox->addWidget( pNumberEdit );
|
||
|
connect( pNumberEdit, SIGNAL(clicked()),
|
||
|
this, SLOT(editNumberClicked())
|
||
|
);
|
||
|
|
||
|
// add a horizontal box layout for the artist and the composer
|
||
|
QHBoxLayout *artistBox = new QHBoxLayout( -1, "artistBox" );
|
||
|
tagsGridLayout->addLayout( artistBox, 1, 1 );
|
||
|
// and fill it up
|
||
|
lArtistLabel = new QLabel( i18n("Artist:"), tags, "lArtistLabel" );
|
||
|
tagsGridLayout->addWidget( lArtistLabel, 1, 0 );
|
||
|
lArtist = new KLineEdit( tags, "lArtist" );
|
||
|
artistBox->addWidget( lArtist );
|
||
|
connect( lArtist, SIGNAL(textChanged(const QString&)),
|
||
|
this, SLOT(artistChanged(const QString&))
|
||
|
);
|
||
|
pArtistEdit = new KPushButton( " ", tags, "pArtistEdit" );
|
||
|
pArtistEdit->setPixmap( iconLoader->loadIcon("kwrite",KIcon::Small) );
|
||
|
pArtistEdit->setFixedSize( lArtist->sizeHint().height(), lArtist->sizeHint().height() );
|
||
|
pArtistEdit->hide();
|
||
|
artistBox->addWidget( pArtistEdit );
|
||
|
connect( pArtistEdit, SIGNAL(clicked()),
|
||
|
this, SLOT(editArtistClicked())
|
||
|
);
|
||
|
lComposerLabel = new QLabel( i18n("Composer:"), tags, "lComposerLabel" );
|
||
|
artistBox->addWidget( lComposerLabel );
|
||
|
lComposer = new KLineEdit( tags, "lComposer" );
|
||
|
artistBox->addWidget( lComposer );
|
||
|
connect( lComposer, SIGNAL(textChanged(const QString&)),
|
||
|
this, SLOT(composerChanged(const QString&))
|
||
|
);
|
||
|
pComposerEdit = new KPushButton( " ", tags, "pComposerEdit" );
|
||
|
pComposerEdit->setPixmap( iconLoader->loadIcon("kwrite",KIcon::Small) );
|
||
|
pComposerEdit->setFixedSize( lComposer->sizeHint().height(), lComposer->sizeHint().height() );
|
||
|
pComposerEdit->hide();
|
||
|
artistBox->addWidget( pComposerEdit );
|
||
|
connect( pComposerEdit, SIGNAL(clicked()),
|
||
|
this, SLOT(editComposerClicked())
|
||
|
);
|
||
|
|
||
|
// add a horizontal box layout for the album
|
||
|
QHBoxLayout *albumBox = new QHBoxLayout( -1, "albumBox" );
|
||
|
tagsGridLayout->addLayout( albumBox, 2, 1 );
|
||
|
// and fill it up
|
||
|
lAlbumLabel = new QLabel( i18n("Album:"), tags, "lAlbumLabel" );
|
||
|
tagsGridLayout->addWidget( lAlbumLabel, 2, 0 );
|
||
|
lAlbum = new KLineEdit( tags, "lAlbum" );
|
||
|
albumBox->addWidget( lAlbum );
|
||
|
connect( lAlbum, SIGNAL(textChanged(const QString&)),
|
||
|
this, SLOT(albumChanged(const QString&))
|
||
|
);
|
||
|
pAlbumEdit = new KPushButton( " ", tags, "pAlbumEdit" );
|
||
|
pAlbumEdit->setPixmap( iconLoader->loadIcon("kwrite",KIcon::Small) );
|
||
|
pAlbumEdit->setFixedSize( lAlbum->sizeHint().height(), lAlbum->sizeHint().height() );
|
||
|
pAlbumEdit->hide();
|
||
|
albumBox->addWidget( pAlbumEdit );
|
||
|
connect( pAlbumEdit, SIGNAL(clicked()),
|
||
|
this, SLOT(editAlbumClicked())
|
||
|
);
|
||
|
|
||
|
// add a horizontal box layout for the disc number, year and genre
|
||
|
QHBoxLayout *albumdataBox = new QHBoxLayout( -1, "albumdataBox" );
|
||
|
tagsGridLayout->addLayout( albumdataBox, 3, 1 );
|
||
|
// and fill it up
|
||
|
lDiscLabel = new QLabel( i18n("Disc No.:"), tags, "lDiscLabel" );
|
||
|
tagsGridLayout->addWidget( lDiscLabel, 3, 0 );
|
||
|
iDisc = new KIntSpinBox( 0, 99, 1, 1, 10, tags, "iDisc" );
|
||
|
albumdataBox->addWidget( iDisc );
|
||
|
connect( iDisc, SIGNAL(valueChanged(int)),
|
||
|
this, SLOT(discChanged(int))
|
||
|
);
|
||
|
pDiscEdit = new KPushButton( " ", tags, "pDiscEdit" );
|
||
|
pDiscEdit->setPixmap( iconLoader->loadIcon("kwrite",KIcon::Small) );
|
||
|
pDiscEdit->setFixedSize( iDisc->sizeHint().height(), iDisc->sizeHint().height() );
|
||
|
pDiscEdit->hide();
|
||
|
albumdataBox->addWidget( pDiscEdit );
|
||
|
connect( pDiscEdit, SIGNAL(clicked()),
|
||
|
this, SLOT(editDiscClicked())
|
||
|
);
|
||
|
albumdataBox->addStretch();
|
||
|
lYearLabel = new QLabel( i18n("Year:"), tags, "lYearLabel" );
|
||
|
albumdataBox->addWidget( lYearLabel );
|
||
|
iYear = new KIntSpinBox( 0, 99999, 1, QDate::currentDate().year(), 10, tags, "iYear" );
|
||
|
albumdataBox->addWidget( iYear );
|
||
|
connect( iYear, SIGNAL(valueChanged(int)),
|
||
|
this, SLOT(yearChanged(int))
|
||
|
);
|
||
|
pYearEdit = new KPushButton( " ", tags, "pYearEdit" );
|
||
|
pYearEdit->setPixmap( iconLoader->loadIcon("kwrite",KIcon::Small) );
|
||
|
pYearEdit->setFixedSize( iYear->sizeHint().height(), iYear->sizeHint().height() );
|
||
|
pYearEdit->hide();
|
||
|
albumdataBox->addWidget( pYearEdit );
|
||
|
connect( pYearEdit, SIGNAL(clicked()),
|
||
|
this, SLOT(editYearClicked())
|
||
|
);
|
||
|
albumdataBox->addStretch();
|
||
|
lGenreLabel = new QLabel( i18n("Genre:"), tags, "lGenreLabel" );
|
||
|
albumdataBox->addWidget( lGenreLabel );
|
||
|
cGenre = new KComboBox( true, tags, "cGenre" );
|
||
|
cGenre->insertStringList( tagEngine->genreList );
|
||
|
cGenre->setCurrentText( "" );
|
||
|
KCompletion *cGenreCompletion = cGenre->completionObject();
|
||
|
cGenreCompletion->insertItems( tagEngine->genreList );
|
||
|
cGenreCompletion->setIgnoreCase( tags );
|
||
|
albumdataBox->addWidget( cGenre );
|
||
|
connect( cGenre, SIGNAL(textChanged(const QString&)),
|
||
|
this, SLOT(genreChanged(const QString&))
|
||
|
);
|
||
|
pGenreEdit = new KPushButton( " ", tags, "pGenreEdit" );
|
||
|
pGenreEdit->setPixmap( iconLoader->loadIcon("kwrite",KIcon::Small) );
|
||
|
pGenreEdit->setFixedSize( cGenre->sizeHint().height(), cGenre->sizeHint().height() );
|
||
|
pGenreEdit->hide();
|
||
|
albumdataBox->addWidget( pGenreEdit );
|
||
|
connect( pGenreEdit, SIGNAL(clicked()),
|
||
|
this, SLOT(editGenreClicked())
|
||
|
);
|
||
|
|
||
|
// add a horizontal box layout for the comment
|
||
|
QHBoxLayout *commentBox = new QHBoxLayout( -1, "commentBox" );
|
||
|
tagsGridLayout->addLayout( commentBox, 4, 1 );
|
||
|
// and fill it up
|
||
|
lCommentLabel = new QLabel( i18n("Comment:"), tags, "lCommentLabel" );
|
||
|
tagsGridLayout->addWidget( lCommentLabel, 4, 0 );
|
||
|
tComment = new KTextEdit( tags, "tComment" );
|
||
|
commentBox->addWidget( tComment );
|
||
|
connect( tComment, SIGNAL(textChanged()),
|
||
|
this, SLOT(commentChanged())
|
||
|
);
|
||
|
pCommentEdit = new KPushButton( " ", tags, "pCommentEdit" );
|
||
|
pCommentEdit->setPixmap( iconLoader->loadIcon("kwrite",KIcon::Small) );
|
||
|
pCommentEdit->setFixedSize( lTitle->sizeHint().height(), lTitle->sizeHint().height() );
|
||
|
pCommentEdit->hide();
|
||
|
commentBox->addWidget( pCommentEdit );
|
||
|
connect( pCommentEdit, SIGNAL(clicked()),
|
||
|
this, SLOT(editCommentClicked())
|
||
|
);
|
||
|
tagsGridLayout->setRowStretch( 4, 1 );
|
||
|
|
||
|
lEditTags = new QLabel( "", tags, "lEditTags" );
|
||
|
tagsGridLayout->addWidget( lEditTags, 5, 1 );
|
||
|
lEditTags->setAlignment( Qt::AlignHCenter );
|
||
|
lEditTags->hide();
|
||
|
pEditTags = new KPushButton( i18n("Edit tags"), tags, "pEditTags" );
|
||
|
pEditTags->setFixedWidth( pEditTags->sizeHint().width() );
|
||
|
tagsGridLayout->addWidget( pEditTags, 6, 1, Qt::AlignHCenter );
|
||
|
pEditTags->hide();
|
||
|
connect( pEditTags, SIGNAL(clicked()),
|
||
|
this, SLOT(editTagsClicked())
|
||
|
);
|
||
|
|
||
|
// delete the icon loader object
|
||
|
delete iconLoader;
|
||
|
}
|
||
|
|
||
|
OptionsEditor::~OptionsEditor()
|
||
|
{}
|
||
|
|
||
|
/*void OptionsEditor::moveWindow( int x, int y )
|
||
|
{
|
||
|
move( x, y );
|
||
|
}*/
|
||
|
|
||
|
void OptionsEditor::setTagInputEnabled( bool enabled )
|
||
|
{
|
||
|
lTitleLabel->setEnabled( enabled );
|
||
|
lTitle->setEnabled( enabled );
|
||
|
pTitleEdit->hide();
|
||
|
lNumberLabel->setEnabled( enabled );
|
||
|
iNumber->setEnabled( enabled );
|
||
|
pNumberEdit->hide();
|
||
|
lArtistLabel->setEnabled( enabled );
|
||
|
lArtist->setEnabled( enabled );
|
||
|
pArtistEdit->hide();
|
||
|
lComposerLabel->setEnabled( enabled );
|
||
|
lComposer->setEnabled( enabled );
|
||
|
pComposerEdit->hide();
|
||
|
lAlbumLabel->setEnabled( enabled );
|
||
|
lAlbum->setEnabled( enabled );
|
||
|
pAlbumEdit->hide();
|
||
|
lDiscLabel->setEnabled( enabled );
|
||
|
iDisc->setEnabled( enabled );
|
||
|
pDiscEdit->hide();
|
||
|
lYearLabel->setEnabled( enabled );
|
||
|
iYear->setEnabled( enabled );
|
||
|
pYearEdit->hide();
|
||
|
lGenreLabel->setEnabled( enabled );
|
||
|
cGenre->setEnabled( enabled );
|
||
|
pGenreEdit->hide();
|
||
|
lCommentLabel->setEnabled( enabled );
|
||
|
tComment->setEnabled( enabled );
|
||
|
tComment->setReadOnly( !enabled );
|
||
|
pCommentEdit->hide();
|
||
|
|
||
|
if( !enabled ) {
|
||
|
lTitle->setText( "" );
|
||
|
iNumber->setValue( 0 );
|
||
|
lArtist->setText( "" );
|
||
|
lComposer->setText( "" );
|
||
|
lAlbum->setText( "" );
|
||
|
iDisc->setValue( 0 );
|
||
|
iYear->setValue( 0 );
|
||
|
cGenre->setCurrentText( "" );
|
||
|
tComment->setText( "" );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::itemsSelected( QValueList<FileListItem*> items )
|
||
|
{
|
||
|
for( QValueList<FileListItem*>::Iterator it = items.begin(); it != items.end(); ) {
|
||
|
if( (*it)->converting || (*it) == 0 ) it = items.remove( it );
|
||
|
else it++;
|
||
|
}
|
||
|
|
||
|
selectedItems = items;
|
||
|
|
||
|
if( items.count() == 0 ) {
|
||
|
setCaption( i18n("No file selected") );
|
||
|
options->setEnabled( false );
|
||
|
lEditOptions->hide();
|
||
|
pEditOptions->hide();
|
||
|
setTagInputEnabled( false );
|
||
|
lEditTags->hide();
|
||
|
pEditTags->hide();
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
options->setEnabled( true );
|
||
|
lEditOptions->hide();
|
||
|
pEditOptions->hide();
|
||
|
setTagInputEnabled( true );
|
||
|
lEditTags->hide();
|
||
|
pEditTags->hide();
|
||
|
|
||
|
if( items.count() == 1 ) {
|
||
|
setCaption( KURL::decode_string(items.first()->fileName).replace("%2f","/").replace("%%","%") );
|
||
|
// HACK ...but seems to work...
|
||
|
// FIXME directory does get set properly
|
||
|
disconnect( options, SIGNAL(optionsChanged()), 0, 0 );
|
||
|
options->setCurrentOptions( items.first()->options );
|
||
|
connect( options, SIGNAL(optionsChanged()),
|
||
|
this, SLOT(optionsChanged())
|
||
|
);
|
||
|
if( items.first()->tags == 0 && !items.first()->local ) {
|
||
|
setTagInputEnabled( false );
|
||
|
lEditTags->setText( i18n("The tags could not be read, because this file isn't a local one.\n"
|
||
|
"soundKonverter will try to read the tags, when it is about to convert the file.\n"
|
||
|
"If you want to edit the tags, you can hit the button below but then soundKonverter will not try\n"
|
||
|
"to read the tags.") );
|
||
|
lEditTags->show();
|
||
|
pEditTags->show();
|
||
|
}
|
||
|
else if( items.first()->tags == 0 ) {
|
||
|
setTagInputEnabled( false );
|
||
|
lEditTags->setText( i18n("Reading the tags of this file failed.\n"
|
||
|
"soundKonverter will try to read the tags a second time, when it is about to convert the file.\n"
|
||
|
"If you want to edit the tags, you can hit the button below but then soundKonverter will not try\n"
|
||
|
"to read the tags a second time.") );
|
||
|
lEditTags->show();
|
||
|
pEditTags->show();
|
||
|
}
|
||
|
else {
|
||
|
lTitle->setText( items.first()->tags->title );
|
||
|
iNumber->setValue( items.first()->tags->track );
|
||
|
lArtist->setText( items.first()->tags->artist );
|
||
|
lComposer->setText( items.first()->tags->composer );
|
||
|
lAlbum->setText( items.first()->tags->album );
|
||
|
iDisc->setValue( items.first()->tags->disc );
|
||
|
iYear->setValue( items.first()->tags->year );
|
||
|
cGenre->setCurrentText( items.first()->tags->genre );
|
||
|
tComment->setText( items.first()->tags->comment );
|
||
|
}
|
||
|
}
|
||
|
else {
|
||
|
setCaption( i18n("%1 Files").arg(items.count()) );
|
||
|
QValueList<FileListItem*>::Iterator it = items.begin();
|
||
|
ConversionOptions cOptions = (*it)->options;
|
||
|
QString title = ( (*it)->tags == 0 ) ? "" : (*it)->tags->title;
|
||
|
int number = ( (*it)->tags == 0 ) ? 0 : (*it)->tags->track;
|
||
|
QString artist = ( (*it)->tags == 0 ) ? "" : (*it)->tags->artist;
|
||
|
QString composer = ( (*it)->tags == 0 ) ? "" : (*it)->tags->composer;
|
||
|
QString album = ( (*it)->tags == 0 ) ? "" : (*it)->tags->album;
|
||
|
int disc = ( (*it)->tags == 0 ) ? 0 : (*it)->tags->disc;
|
||
|
int year = ( (*it)->tags == 0 ) ? 0 : (*it)->tags->year;
|
||
|
QString genre = ( (*it)->tags == 0 ) ? "" : (*it)->tags->genre;
|
||
|
QString comment = ( (*it)->tags == 0 ) ? "" : (*it)->tags->comment;
|
||
|
while( it != items.end() ) {
|
||
|
if( !cOptions.nearlyEqual((*it)->options) ) {
|
||
|
options->setEnabled( false );
|
||
|
lEditOptions->setText( i18n("You have selected multiple files with different conversion options.\nYou can change the options of all files by hitting the button below.") );
|
||
|
lEditOptions->show();
|
||
|
pEditOptions->show();
|
||
|
}
|
||
|
if( (*it)->tags == 0 ) {
|
||
|
setTagInputEnabled( false );
|
||
|
lEditTags->setText( i18n("Reading the tags of one or more files failed.\n"
|
||
|
"soundKonverter will try to read the tags a second time, when it is about to convert the files.\n"
|
||
|
"If you want to edit the tags, you can hit the button below but then soundKonverter will not try\n"
|
||
|
"to read the tags a second time.") );
|
||
|
lEditTags->show();
|
||
|
pEditTags->show();
|
||
|
it++;
|
||
|
continue;
|
||
|
}
|
||
|
if( title != (*it)->tags->title && lTitle->isEnabled() ) {
|
||
|
lTitle->setEnabled( false );
|
||
|
lTitle->setText( "" );
|
||
|
pTitleEdit->show();
|
||
|
}
|
||
|
if( number != (*it)->tags->track && iNumber->isEnabled() ) {
|
||
|
iNumber->setEnabled( false );
|
||
|
iNumber->setValue( 1 );
|
||
|
pNumberEdit->show();
|
||
|
}
|
||
|
if( artist != (*it)->tags->artist && lArtist->isEnabled() ) {
|
||
|
lArtist->setEnabled( false );
|
||
|
lArtist->setText( "" );
|
||
|
pArtistEdit->show();
|
||
|
}
|
||
|
if( composer != (*it)->tags->composer && lComposer->isEnabled() ) {
|
||
|
lComposer->setEnabled( false );
|
||
|
lComposer->setText( "" );
|
||
|
pComposerEdit->show();
|
||
|
}
|
||
|
if( album != (*it)->tags->album && lAlbum->isEnabled() ) {
|
||
|
lAlbum->setEnabled( false );
|
||
|
lAlbum->setText( "" );
|
||
|
pAlbumEdit->show();
|
||
|
}
|
||
|
if( disc != (*it)->tags->disc && iDisc->isEnabled() ) {
|
||
|
iDisc->setEnabled( false );
|
||
|
iDisc->setValue( 1 );
|
||
|
pDiscEdit->show();
|
||
|
}
|
||
|
if( year != (*it)->tags->year && iYear->isEnabled() ) {
|
||
|
iYear->setEnabled( false );
|
||
|
iYear->setValue( QDate::currentDate().year() );
|
||
|
pYearEdit->show();
|
||
|
}
|
||
|
if( genre != (*it)->tags->genre && cGenre->isEnabled() ) {
|
||
|
cGenre->setEnabled( false );
|
||
|
cGenre->setCurrentText( "" );
|
||
|
pGenreEdit->show();
|
||
|
}
|
||
|
if( comment != (*it)->tags->comment && tComment->isEnabled() ) {
|
||
|
tComment->setEnabled( false );
|
||
|
tComment->setReadOnly( true );
|
||
|
tComment->setText( "" );
|
||
|
pCommentEdit->show();
|
||
|
}
|
||
|
it++;
|
||
|
}
|
||
|
if( options->isEnabled() ) {
|
||
|
// HACK ...but seems to work...
|
||
|
// FIXME directory does get set properly
|
||
|
disconnect( options, SIGNAL(optionsChanged()), 0, 0 );
|
||
|
options->setCurrentOptions( items.first()->options );
|
||
|
connect( options, SIGNAL(optionsChanged()),
|
||
|
this, SLOT(optionsChanged())
|
||
|
);
|
||
|
}
|
||
|
if( lTitle->isEnabled() ) {
|
||
|
lTitle->setText( title );
|
||
|
}
|
||
|
if( iNumber->isEnabled() ) {
|
||
|
iNumber->setValue( number );
|
||
|
}
|
||
|
if( lArtist->isEnabled() ) {
|
||
|
lArtist->setText( artist );
|
||
|
}
|
||
|
if( lComposer->isEnabled() ) {
|
||
|
lComposer->setText( composer );
|
||
|
}
|
||
|
if( lAlbum->isEnabled() ) {
|
||
|
lAlbum->setText( album );
|
||
|
}
|
||
|
if( iDisc->isEnabled() ) {
|
||
|
iDisc->setValue( disc );
|
||
|
}
|
||
|
if( iYear->isEnabled() ) {
|
||
|
iYear->setValue( year );
|
||
|
}
|
||
|
if( cGenre->isEnabled() ) {
|
||
|
cGenre->setCurrentText( genre );
|
||
|
}
|
||
|
if( tComment->isEnabled() ) {
|
||
|
tComment->setText( comment );
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::setPreviousEnabled( bool enabled )
|
||
|
{
|
||
|
enableButton( User2, enabled );
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::setNextEnabled( bool enabled )
|
||
|
{
|
||
|
enableButton( User1, enabled );
|
||
|
}
|
||
|
|
||
|
|
||
|
void OptionsEditor::optionsChanged()
|
||
|
{
|
||
|
if( !options->isEnabled() ) return;
|
||
|
|
||
|
QString filePathName;
|
||
|
// QString outputFilePathName;
|
||
|
|
||
|
for( QValueList<FileListItem*>::Iterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
|
||
|
filePathName = (*it)->options.filePathName;
|
||
|
// outputFilePathName = (*it)->options.outputFilePathName;
|
||
|
(*it)->options = options->getCurrentOptions();
|
||
|
(*it)->options.filePathName = filePathName;
|
||
|
// (*it)->options.outputFilePathName = outputFilePathName;
|
||
|
//(*it)->updateOptionsCell();
|
||
|
//(*it)->updateOutputCell();
|
||
|
fileList->updateItem( *it );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::titleChanged( const QString& text )
|
||
|
{
|
||
|
if( !lTitle->isEnabled() ) return;
|
||
|
|
||
|
for( QValueList<FileListItem*>::Iterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
|
||
|
(*it)->tags->title = text;
|
||
|
//(*it)->updateOutputCell();
|
||
|
fileList->updateItem( *it );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::numberChanged( int value )
|
||
|
{
|
||
|
if( !iNumber->isEnabled() ) return;
|
||
|
|
||
|
for( QValueList<FileListItem*>::Iterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
|
||
|
(*it)->tags->track = value;
|
||
|
//(*it)->updateOutputCell();
|
||
|
fileList->updateItem( *it );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::artistChanged( const QString& text )
|
||
|
{
|
||
|
if( !lArtist->isEnabled() ) return;
|
||
|
|
||
|
for( QValueList<FileListItem*>::Iterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
|
||
|
(*it)->tags->artist = text;
|
||
|
//(*it)->updateOutputCell();
|
||
|
fileList->updateItem( *it );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::composerChanged( const QString& text )
|
||
|
{
|
||
|
if( !lComposer->isEnabled() ) return;
|
||
|
|
||
|
for( QValueList<FileListItem*>::Iterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
|
||
|
(*it)->tags->composer = text;
|
||
|
//(*it)->updateOutputCell();
|
||
|
fileList->updateItem( *it );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::albumChanged( const QString& text )
|
||
|
{
|
||
|
if( !lAlbum->isEnabled() ) return;
|
||
|
|
||
|
for( QValueList<FileListItem*>::Iterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
|
||
|
(*it)->tags->album = text;
|
||
|
//(*it)->updateOutputCell();
|
||
|
fileList->updateItem( *it );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::discChanged( int value )
|
||
|
{
|
||
|
if( !iDisc->isEnabled() ) return;
|
||
|
|
||
|
for( QValueList<FileListItem*>::Iterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
|
||
|
(*it)->tags->disc = value;
|
||
|
//(*it)->updateOutputCell();
|
||
|
fileList->updateItem( *it );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::yearChanged( int value )
|
||
|
{
|
||
|
if( !iYear->isEnabled() ) return;
|
||
|
|
||
|
for( QValueList<FileListItem*>::Iterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
|
||
|
(*it)->tags->year = value;
|
||
|
//(*it)->updateOutputCell();
|
||
|
fileList->updateItem( *it );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::genreChanged( const QString& text )
|
||
|
{
|
||
|
if( !cGenre->isEnabled() ) return;
|
||
|
|
||
|
for( QValueList<FileListItem*>::Iterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
|
||
|
(*it)->tags->genre = text;
|
||
|
//(*it)->updateOutputCell();
|
||
|
fileList->updateItem( *it );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::commentChanged()
|
||
|
{
|
||
|
if( !tComment->isEnabled() ) return;
|
||
|
|
||
|
QString text = tComment->text();
|
||
|
|
||
|
for( QValueList<FileListItem*>::Iterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
|
||
|
(*it)->tags->comment = text;
|
||
|
//(*it)->updateOutputCell();
|
||
|
fileList->updateItem( *it );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
void OptionsEditor::editTitleClicked()
|
||
|
{
|
||
|
lTitle->setEnabled( true );
|
||
|
lTitle->setFocus();
|
||
|
pTitleEdit->hide();
|
||
|
titleChanged( lTitle->text() );
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::editNumberClicked()
|
||
|
{
|
||
|
iNumber->setEnabled( true );
|
||
|
iNumber->setFocus();
|
||
|
pNumberEdit->hide();
|
||
|
numberChanged( iNumber->value() );
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::editArtistClicked()
|
||
|
{
|
||
|
lArtist->setEnabled( true );
|
||
|
lArtist->setFocus();
|
||
|
pArtistEdit->hide();
|
||
|
artistChanged( lArtist->text() );
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::editComposerClicked()
|
||
|
{
|
||
|
lComposer->setEnabled( true );
|
||
|
lComposer->setFocus();
|
||
|
pComposerEdit->hide();
|
||
|
composerChanged( lComposer->text() );
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::editAlbumClicked()
|
||
|
{
|
||
|
lAlbum->setEnabled( true );
|
||
|
lAlbum->setFocus();
|
||
|
pAlbumEdit->hide();
|
||
|
albumChanged( lAlbum->text() );
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::editDiscClicked()
|
||
|
{
|
||
|
iDisc->setEnabled( true );
|
||
|
iDisc->setFocus();
|
||
|
pDiscEdit->hide();
|
||
|
discChanged( iDisc->value() );
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::editYearClicked()
|
||
|
{
|
||
|
iYear->setEnabled( true );
|
||
|
iYear->setFocus();
|
||
|
pYearEdit->hide();
|
||
|
yearChanged( iYear->value() );
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::editGenreClicked()
|
||
|
{
|
||
|
cGenre->setEnabled( true );
|
||
|
cGenre->setFocus();
|
||
|
pGenreEdit->hide();
|
||
|
genreChanged( cGenre->currentText() );
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::editCommentClicked()
|
||
|
{
|
||
|
tComment->setEnabled( true );
|
||
|
tComment->setReadOnly( false );
|
||
|
tComment->setFocus();
|
||
|
pCommentEdit->hide();
|
||
|
commentChanged();
|
||
|
}
|
||
|
|
||
|
|
||
|
void OptionsEditor::editOptionsClicked()
|
||
|
{
|
||
|
// TODO set default / first profile (use config values)
|
||
|
options->setProfile( i18n("Medium") );
|
||
|
options->setFormat( "ogg" );
|
||
|
options->setEnabled( true );
|
||
|
lEditOptions->hide();
|
||
|
pEditOptions->hide();
|
||
|
optionsChanged();
|
||
|
}
|
||
|
|
||
|
void OptionsEditor::editTagsClicked()
|
||
|
{
|
||
|
for( QValueList<FileListItem*>::Iterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
|
||
|
(*it)->tags = new TagData();
|
||
|
}
|
||
|
|
||
|
itemsSelected( selectedItems );
|
||
|
}
|
||
|
|