205
218
i18n("Reverts the changes of all or the selected files"));
206
219
fileSave->setStatusText(i18n("Saves the changed files"));
207
220
fileQuit->setStatusText(i18n("Quits the application"));
208
viewToolBar->setStatusText(i18n("Enables/disables the toolbar"));
209
viewStatusBar->setStatusText(i18n("Enables/disables the statusbar"));
210
221
settingsShortcuts->setStatusText(i18n("Configure Shortcuts"));
211
222
settingsConfigure->setStatusText(i18n("Preferences dialog"));
213
224
new KAction(i18n("&Import..."), 0, this,
214
225
SLOT(slotImport()), actionCollection(),
227
new KAction(i18n("Import from &freedb.org..."), 0, this,
228
SLOT(slotImportFreedb()), actionCollection(),
231
new KAction(i18n("Import from &MusicBrainz..."), 0, this,
232
SLOT(slotImportMusicBrainz()), actionCollection(),
233
"import_musicbrainz");
235
new KAction(i18n("&Export..."), 0, this,
236
SLOT(slotExport()), actionCollection(),
216
238
new KAction(i18n("&Create Playlist"), 0, this,
217
239
SLOT(slotCreatePlaylist()), actionCollection(),
218
240
"create_playlist");
219
new KAction(i18n("&Apply Format"), 0, this,
220
SLOT(slotApplyFormat()), actionCollection(),
241
new KAction(i18n("Apply &Filename Format"), 0, this,
242
SLOT(slotApplyFilenameFormat()), actionCollection(),
243
"apply_filename_format");
244
new KAction(i18n("Apply &ID3 Format"), 0, this,
245
SLOT(slotApplyId3Format()), actionCollection(),
222
247
new KAction(i18n("&Rename Directory..."), 0, this,
223
248
SLOT(slotRenameDirectory()), actionCollection(),
224
249
"rename_directory");
250
new KAction(i18n("&Number Tracks..."), 0, this,
251
SLOT(slotNumberTracks()), actionCollection(),
254
new KAction(i18n("Hide ID3v&1.1"), 0, this,
255
SLOT(slotSettingsShowHideV1()), actionCollection(),
258
new KAction(i18n("Hide ID3v&2.3"), 0, this,
259
SLOT(slotSettingsShowHideV2()), actionCollection(),
226
262
new KAction(i18n("Select &All"), KShortcut("Alt+A"), this,
227
263
SLOT(slotSelectAll()), actionCollection(),
1177
* Update track data and create import dialog.
1065
void Kid3App::slotImport(void)
1179
void Kid3App::setupImportDialog()
1067
ImportTrackDataVector trackDataList;
1181
m_trackDataList.clear();
1068
1182
TaggedFile *mp3file = view->mp3ListBox->first();
1183
bool firstTrack = true;
1069
1184
while (mp3file != 0) {
1070
1185
mp3file->readTags(false);
1188
mp3file->getStandardTagsV2(&st);
1189
if (st.artist.isEmpty() && st.album.isEmpty()) {
1190
mp3file->getStandardTagsV1(&st);
1192
m_trackDataList.artist = st.artist;
1193
m_trackDataList.album = st.album;
1071
1196
#if QT_VERSION >= 300
1072
trackDataList.push_back(ImportTrackData(mp3file->getAbsFilename(),
1197
m_trackDataList.push_back(ImportTrackData(mp3file->getAbsFilename(),
1073
1198
mp3file->getDuration()));
1075
trackDataList.append(ImportTrackData(mp3file->getAbsFilename(),
1200
m_trackDataList.append(ImportTrackData(mp3file->getAbsFilename(),
1076
1201
mp3file->getDuration()));
1078
1203
mp3file = view->mp3ListBox->next();
1081
QString caption(i18n("Import"));
1082
ImportDialog *dialog =
1083
new ImportDialog(NULL, caption, trackDataList);
1085
dialog->setDestV1(genCfg->importDestV1);
1086
dialog->setImportFormat(genCfg->importFormatNames,
1206
if (!m_importDialog) {
1207
QString caption(i18n("Import"));
1209
new ImportDialog(NULL, caption, m_trackDataList);
1211
if (m_importDialog) {
1212
m_importDialog->clear();
1213
m_importDialog->setDestV1(genCfg->importDestV1);
1214
m_importDialog->setImportFormat(genCfg->importFormatNames,
1087
1215
genCfg->importFormatHeaders,
1088
1216
genCfg->importFormatTracks,
1089
1217
genCfg->importFormatIdx);
1090
dialog->setTimeDifferenceCheck(genCfg->enableTimeDifferenceCheck,
1218
m_importDialog->setTimeDifferenceCheck(genCfg->enableTimeDifferenceCheck,
1091
1219
genCfg->maxTimeDifference);
1092
dialog->setFreedbConfig(freedbCfg);
1093
#ifdef HAVE_TUNEPIMP
1094
dialog->setMusicBrainzConfig(m_musicBrainzCfg);
1096
if (dialog->exec() == QDialog::Accepted) {
1097
genCfg->importDestV1 = dialog->getDestV1();
1098
QString name, header, track;
1099
genCfg->importFormatIdx = dialog->getImportFormat(name, header, track);
1100
genCfg->importFormatNames[genCfg->importFormatIdx] = name;
1101
genCfg->importFormatHeaders[genCfg->importFormatIdx] = header;
1102
genCfg->importFormatTracks[genCfg->importFormatIdx] = track;
1103
dialog->getTimeDifferenceCheck(genCfg->enableTimeDifferenceCheck,
1104
genCfg->maxTimeDifference);
1105
dialog->getFreedbConfig(freedbCfg);
1106
#ifdef HAVE_TUNEPIMP
1107
dialog->getMusicBrainzConfig(m_musicBrainzCfg);
1110
slotStatusMsg(i18n("Import..."));
1111
#if QT_VERSION >= 300
1112
ImportTrackDataVector::const_iterator it = trackDataList.begin();
1114
ImportTrackDataVector::ConstIterator it = trackDataList.begin();
1117
StandardTagsFilter flt(genCfg->importDestV1 ?
1118
view->getFilterFromID3V1() :
1119
view->getFilterFromID3V2());
1120
bool no_selection = view->numFilesSelected() == 0;
1121
TaggedFile *mp3file = view->mp3ListBox->first();
1122
while (mp3file != 0) {
1123
mp3file->readTags(false);
1124
if (genCfg->importDestV1) {
1125
mp3file->getStandardTagsV1(&st);
1127
mp3file->getStandardTagsV2(&st);
1129
if (it != trackDataList.end()) {
1130
(*it).copyActiveTags(st);
1135
if (genCfg->importDestV1) {
1136
mp3file->setStandardTagsV1(&st, flt);
1138
mp3file->setStandardTagsV2(&st, flt);
1140
mp3file = view->mp3ListBox->next();
1142
if (!no_selection) {
1143
StandardTags st; // empty
1144
view->setStandardTagsV1(&st);
1145
view->setStandardTagsV2(&st);
1146
view->nameLineEdit->setEnabled(FALSE);
1150
updateModificationState();
1152
slotStatusMsg(i18n("Ready."));
1153
QApplication::restoreOverrideCursor();
1220
m_importDialog->setFreedbConfig(freedbCfg);
1221
#ifdef HAVE_TUNEPIMP
1222
m_importDialog->setMusicBrainzConfig(m_musicBrainzCfg);
1228
* Execute the import dialog.
1230
void Kid3App::execImportDialog()
1232
if (m_importDialog &&
1233
m_importDialog->exec() == QDialog::Accepted) {
1234
genCfg->importDestV1 = m_importDialog->getDestV1();
1235
QString name, header, track;
1236
genCfg->importFormatIdx = m_importDialog->getImportFormat(name, header, track);
1237
genCfg->importFormatNames[genCfg->importFormatIdx] = name;
1238
genCfg->importFormatHeaders[genCfg->importFormatIdx] = header;
1239
genCfg->importFormatTracks[genCfg->importFormatIdx] = track;
1240
m_importDialog->getTimeDifferenceCheck(genCfg->enableTimeDifferenceCheck,
1241
genCfg->maxTimeDifference);
1242
m_importDialog->getFreedbConfig(freedbCfg);
1243
#ifdef HAVE_TUNEPIMP
1244
m_importDialog->getMusicBrainzConfig(m_musicBrainzCfg);
1247
slotStatusMsg(i18n("Import..."));
1248
#if QT_VERSION >= 300
1249
ImportTrackDataVector::const_iterator it = m_trackDataList.begin();
1251
ImportTrackDataVector::ConstIterator it = m_trackDataList.begin();
1254
StandardTagsFilter flt(genCfg->importDestV1 ?
1255
view->getFilterFromID3V1() :
1256
view->getFilterFromID3V2());
1257
bool no_selection = view->numFilesSelected() == 0;
1258
TaggedFile *mp3file = view->mp3ListBox->first();
1259
while (mp3file != 0) {
1260
mp3file->readTags(false);
1261
if (genCfg->importDestV1) {
1262
mp3file->getStandardTagsV1(&st);
1264
mp3file->getStandardTagsV2(&st);
1266
if (it != m_trackDataList.end()) {
1267
(*it).copyActiveTags(st);
1272
formatStandardTagsIfEnabled(&st);
1273
if (genCfg->importDestV1) {
1274
mp3file->setStandardTagsV1(&st, flt);
1276
mp3file->setStandardTagsV2(&st, flt);
1278
mp3file = view->mp3ListBox->next();
1280
if (!no_selection) {
1281
StandardTags st; // empty
1282
view->setStandardTagsV1(&st);
1283
view->setStandardTagsV2(&st);
1284
view->nameLineEdit->setEnabled(FALSE);
1288
updateModificationState();
1290
slotStatusMsg(i18n("Ready."));
1291
QApplication::restoreOverrideCursor();
1299
void Kid3App::slotImport(void)
1301
setupImportDialog();
1302
if (m_importDialog) {
1303
m_importDialog->setAutoStartSubDialog(ImportDialog::ASD_None);
1309
* Import from freedb.org.
1311
void Kid3App::slotImportFreedb()
1313
setupImportDialog();
1314
if (m_importDialog) {
1315
m_importDialog->setAutoStartSubDialog(ImportDialog::ASD_Freedb);
1321
* Import from MusicBrainz.
1323
void Kid3App::slotImportMusicBrainz()
1325
#ifdef HAVE_TUNEPIMP
1326
setupImportDialog();
1327
if (m_importDialog) {
1328
m_importDialog->setAutoStartSubDialog(ImportDialog::ASD_MusicBrainz);
1335
* Set data to be exported.
1337
* @param src ExportDialog::SrcV1 to export ID3v1,
1338
* ExportDialog::SrcV2 to export ID3v2
1340
void Kid3App::setExportData(int src)
1342
if (m_exportDialog) {
1343
ImportTrackDataVector trackDataVector;
1344
TaggedFile *mp3file = view->mp3ListBox->first();
1345
bool firstTrack = true;
1346
while (mp3file != 0) {
1347
mp3file->readTags(false);
1348
ImportTrackData trackData(mp3file->getAbsFilename(),
1349
mp3file->getDuration());
1350
if (src == ExportDialog::SrcV1) {
1351
mp3file->getStandardTagsV1(&trackData);
1353
mp3file->getStandardTagsV2(&trackData);
1356
trackDataVector.artist = trackData.artist;
1357
trackDataVector.album = trackData.album;
1360
#if QT_VERSION >= 300
1361
trackDataVector.push_back(trackData);
1363
trackDataVector.append(trackData);
1365
mp3file = view->mp3ListBox->next();
1367
m_exportDialog->setExportData(trackDataVector);
1374
void Kid3App::slotExport()
1376
m_exportDialog = new ExportDialog(0);
1377
if (m_exportDialog) {
1378
m_exportDialog->setSrcV1(genCfg->m_exportSrcV1);
1379
m_exportDialog->setExportFormat(
1380
genCfg->m_exportFormatNames, genCfg->m_exportFormatHeaders,
1381
genCfg->m_exportFormatTracks, genCfg->m_exportFormatTrailers,
1382
genCfg->m_exportFormatIdx);
1383
setExportData(genCfg->m_exportSrcV1 ?
1384
ExportDialog::SrcV1 : ExportDialog::SrcV2);
1385
connect(m_exportDialog, SIGNAL(exportDataRequested(int)),
1386
this, SLOT(setExportData(int)));
1387
m_exportDialog->setWindowSize(genCfg->m_exportWindowWidth,
1388
genCfg->m_exportWindowHeight);
1389
if (m_exportDialog->exec() == QDialog::Accepted) {
1390
genCfg->m_exportSrcV1 = m_exportDialog->getSrcV1();
1391
QString name, header, track, trailer;
1392
genCfg->m_exportFormatIdx = m_exportDialog->getExportFormat(
1393
name, header, track, trailer);
1394
genCfg->m_exportFormatNames[genCfg->m_exportFormatIdx] = name;
1395
genCfg->m_exportFormatHeaders[genCfg->m_exportFormatIdx] = header;
1396
genCfg->m_exportFormatTracks[genCfg->m_exportFormatIdx] = track;
1397
genCfg->m_exportFormatTrailers[genCfg->m_exportFormatIdx] = trailer;
1398
m_exportDialog->getWindowSize(genCfg->m_exportWindowWidth,
1399
genCfg->m_exportWindowHeight);
1401
delete m_exportDialog;
1407
* Show or hide the ID3V1.1 controls according to the settings and
1408
* set the menu entries appropriately.
1410
void Kid3App::updateHideV1()
1412
if (miscCfg && miscCfg->m_hideV1) {
1413
view->idV1GroupBox->hide();
1414
#ifdef CONFIG_USE_KDE
1415
settingsShowHideV1->setText(i18n("Show ID3v&1.1"));
1417
settingsShowHideV1->setText(i18n("Show ID3v1.1"));
1418
settingsShowHideV1->setMenuText(i18n("Show ID3v&1.1"));
1422
view->idV1GroupBox->show();
1423
#ifdef CONFIG_USE_KDE
1424
settingsShowHideV1->setText(i18n("Hide ID3v&1.1"));
1426
settingsShowHideV1->setText(i18n("Hide ID3v1.1"));
1427
settingsShowHideV1->setMenuText(i18n("Hide ID3v&1.1"));
1433
* Show or hide the ID3V2.3 controls according to the settings and
1434
* set the menu entries appropriately.
1436
void Kid3App::updateHideV2()
1438
if (miscCfg && miscCfg->m_hideV2) {
1439
view->idV2GroupBox->hide();
1440
#ifdef CONFIG_USE_KDE
1441
settingsShowHideV2->setText(i18n("Show ID3v&2.3"));
1443
settingsShowHideV2->setText(i18n("Show ID3v2.3"));
1444
settingsShowHideV2->setMenuText(i18n("Show ID3v&2.3"));
1448
view->idV2GroupBox->show();
1449
#ifdef CONFIG_USE_KDE
1450
settingsShowHideV2->setText(i18n("Hide ID3v&2.3"));
1452
settingsShowHideV2->setText(i18n("Hide ID3v2.3"));
1453
settingsShowHideV2->setMenuText(i18n("Hide ID3v&2.3"));
1459
* Show or hide ID3v1.1 controls.
1461
void Kid3App::slotSettingsShowHideV1()
1464
miscCfg->m_hideV1 = !miscCfg->m_hideV1;
1470
* Show or hide ID3v2.3 controls.
1472
void Kid3App::slotSettingsShowHideV2()
1475
miscCfg->m_hideV2 = !miscCfg->m_hideV2;