From 831419a680bc3d4ca28f53eb11d14964d5f23cea Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sun, 9 Oct 2011 14:00:11 +0000 Subject: converter: enabled "overwrite existing file" option git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@2388 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/converter/converter.cpp | 16 +++++++++ src/plugins/General/converter/converterdialog.cpp | 3 ++ src/plugins/General/converter/converterdialog.ui | 2 +- .../converter/translations/converter_plugin_cs.ts | 40 +++++++++++----------- .../converter/translations/converter_plugin_de.ts | 40 +++++++++++----------- .../converter/translations/converter_plugin_es.ts | 40 +++++++++++----------- .../converter/translations/converter_plugin_it.ts | 40 +++++++++++----------- .../converter/translations/converter_plugin_ja.ts | 40 +++++++++++----------- .../converter/translations/converter_plugin_lt.ts | 40 +++++++++++----------- .../converter/translations/converter_plugin_nl.ts | 40 +++++++++++----------- .../converter/translations/converter_plugin_pl.ts | 40 +++++++++++----------- .../converter/translations/converter_plugin_ru.ts | 40 +++++++++++----------- .../converter/translations/converter_plugin_tr.ts | 40 +++++++++++----------- .../translations/converter_plugin_uk_UA.ts | 40 +++++++++++----------- .../translations/converter_plugin_zh_CN.ts | 40 +++++++++++----------- .../translations/converter_plugin_zh_TW.ts | 40 +++++++++++----------- 16 files changed, 280 insertions(+), 261 deletions(-) (limited to 'src') diff --git a/src/plugins/General/converter/converter.cpp b/src/plugins/General/converter/converter.cpp index 6ecb6667c..5296b2fdf 100644 --- a/src/plugins/General/converter/converter.cpp +++ b/src/plugins/General/converter/converter.cpp @@ -149,6 +149,22 @@ void Converter::run() QString name = formatter.parse(list[0]->metaData(), list[0]->length()); QString full_path = out_path + "/" + name + "." + preset["ext"].toString(); + + if(QFile::exists(full_path)) + { + if(preset["overwrite"].toBool()) //remove previous file + QFile::remove(full_path); + else + { + int i = 0; + while(QFile::exists(full_path)) //create file with another name + { + ++i; + full_path = out_path + "/" + name + QString("_%1.").arg(i) + preset["ext"].toString(); + } + } + } + QString command = preset["command"].toString(); command.replace("%o", "\"" + full_path + "\""); diff --git a/src/plugins/General/converter/converterdialog.cpp b/src/plugins/General/converter/converterdialog.cpp index e4938afe6..f648f5950 100644 --- a/src/plugins/General/converter/converterdialog.cpp +++ b/src/plugins/General/converter/converterdialog.cpp @@ -48,6 +48,7 @@ ConverterDialog::ConverterDialog(QList items, QWidget *parent) QString music_path = QDesktopServices::storageLocation(QDesktopServices::MusicLocation); ui.outDirEdit->setText(settings.value("out_dir", music_path).toString()); ui.outFileEdit->setText(settings.value("file_name","%p - %t").toString()); + ui.overwriteCheckBox->setChecked(settings.value("overwrite",false).toBool()); settings.endGroup(); createMenus(); @@ -80,6 +81,7 @@ QVariantMap ConverterDialog::preset() const QVariantMap preset = ui.presetComboBox->itemData(index).toMap(); preset["out_dir"] = ui.outDirEdit->text(); preset["file_name"] = ui.outFileEdit->text(); + preset["overwrite"] = ui.overwriteCheckBox->isChecked(); return preset; } @@ -97,6 +99,7 @@ void ConverterDialog::accept() settings.beginGroup("Converter"); settings.setValue("out_dir", ui.outDirEdit->text()); settings.value("file_name", ui.outFileEdit->text()); + settings.setValue("overwrite", ui.overwriteCheckBox->isChecked()); settings.endGroup(); QDialog::accept(); } diff --git a/src/plugins/General/converter/converterdialog.ui b/src/plugins/General/converter/converterdialog.ui index 4cf79a0f7..34e36fbd0 100644 --- a/src/plugins/General/converter/converterdialog.ui +++ b/src/plugins/General/converter/converterdialog.ui @@ -68,7 +68,7 @@ - + Overwrite existing files diff --git a/src/plugins/General/converter/translations/converter_plugin_cs.ts b/src/plugins/General/converter/translations/converter_plugin_cs.ts index 29fffaa4a..7b0a5b341 100644 --- a/src/plugins/General/converter/translations/converter_plugin_cs.ts +++ b/src/plugins/General/converter/translations/converter_plugin_cs.ts @@ -4,12 +4,12 @@ Converter - + Track: %1 - + Preset: %1 @@ -47,92 +47,92 @@ - + Choose a directory Vyberte adresář - + Artist Umělec - + Album Album - + Title Název - + Track number Číslo stopy - + Two-digit track number Dvoumístné číslo stopy - + Genre Žánr - + Comment Poznámka - + Composer Skladatel - + Duration Délka - + Disc number Číslo disku - + File name Název souboru - + Create a copy - + Year Rok - + Condition Stav - + Create - + Edit - + Delete diff --git a/src/plugins/General/converter/translations/converter_plugin_de.ts b/src/plugins/General/converter/translations/converter_plugin_de.ts index e19618fc7..3d8f894b8 100644 --- a/src/plugins/General/converter/translations/converter_plugin_de.ts +++ b/src/plugins/General/converter/translations/converter_plugin_de.ts @@ -4,12 +4,12 @@ Converter - + Track: %1 - + Preset: %1 @@ -47,92 +47,92 @@ Vorhandene Dateien überschreiben - + Choose a directory Ein Verzeichnis wählen - + Artist Interpret - + Album Album - + Title Titel - + Track number Stücknummer - + Two-digit track number Zweistellige Stücknummer - + Genre Genre - + Comment Kommentar - + Composer Komponist - + Duration Abspieldauer - + Disc number CD-Nummer - + File name Dateiname - + Create a copy - + Year Jahr - + Condition Zustand - + Create - + Edit - + Delete diff --git a/src/plugins/General/converter/translations/converter_plugin_es.ts b/src/plugins/General/converter/translations/converter_plugin_es.ts index c02abd66e..17674cd56 100644 --- a/src/plugins/General/converter/translations/converter_plugin_es.ts +++ b/src/plugins/General/converter/translations/converter_plugin_es.ts @@ -4,12 +4,12 @@ Converter - + Track: %1 - + Preset: %1 @@ -47,92 +47,92 @@ - + Choose a directory Elija un directorio - + Artist Intérprete - + Album Album - + Title Título - + Track number Número de pista - + Two-digit track number Número de pista con dos cifras - + Genre Género - + Comment Comentario - + Composer Compositor - + Duration Duración - + Disc number Número de disco - + File name Nombre del archivo - + Create a copy - + Year Año - + Condition Condición - + Create - + Edit - + Delete diff --git a/src/plugins/General/converter/translations/converter_plugin_it.ts b/src/plugins/General/converter/translations/converter_plugin_it.ts index 49178d234..8e3ea94cc 100644 --- a/src/plugins/General/converter/translations/converter_plugin_it.ts +++ b/src/plugins/General/converter/translations/converter_plugin_it.ts @@ -4,12 +4,12 @@ Converter - + Track: %1 - + Preset: %1 @@ -47,92 +47,92 @@ - + Choose a directory Scegli una cartella - + Artist Interprete - + Album Album - + Title Titolo - + Track number Numero traccia - + Two-digit track number Numero traccia su due cifre - + Genre Genere - + Comment Commento - + Composer Compositore - + Duration Durata - + Disc number Disco num. - + File name Nome documento - + Create a copy - + Year Anno - + Condition PErcorso documento - + Create - + Edit - + Delete diff --git a/src/plugins/General/converter/translations/converter_plugin_ja.ts b/src/plugins/General/converter/translations/converter_plugin_ja.ts index 10b5711c0..e841149c7 100644 --- a/src/plugins/General/converter/translations/converter_plugin_ja.ts +++ b/src/plugins/General/converter/translations/converter_plugin_ja.ts @@ -4,12 +4,12 @@ Converter - + Track: %1 - + Preset: %1 @@ -47,92 +47,92 @@ - + Choose a directory ディレクトリを選択 - + Artist アーティスト - + Album アルバム - + Title タイトル - + Track number トラック番号 - + Two-digit track number トラック番号 数字2桁 - + Genre ジャンル - + Comment コメント - + Composer 作曲者 - + Duration 演奏時間 - + Disc number ディスク番号 - + File name ファイル名 - + Create a copy - + Year - + Condition 定番 - + Create - + Edit - + Delete diff --git a/src/plugins/General/converter/translations/converter_plugin_lt.ts b/src/plugins/General/converter/translations/converter_plugin_lt.ts index b70b6c47b..d9f6d46fe 100644 --- a/src/plugins/General/converter/translations/converter_plugin_lt.ts +++ b/src/plugins/General/converter/translations/converter_plugin_lt.ts @@ -4,12 +4,12 @@ Converter - + Track: %1 - + Preset: %1 @@ -47,92 +47,92 @@ - + Choose a directory Pasirinkite aplanką - + Artist Atlikėjas - + Album Albumas - + Title Pavadinimas - + Track number Takelio numeris - + Two-digit track number Dviejų skaitmenų takelio numeris - + Genre Žanras - + Comment Komentaras - + Composer Autorius - + Duration Trukmė - + Disc number Disko numeris - + File name Bylos pavadinimas - + Create a copy - + Year Metai - + Condition Būklė - + Create - + Edit - + Delete diff --git a/src/plugins/General/converter/translations/converter_plugin_nl.ts b/src/plugins/General/converter/translations/converter_plugin_nl.ts index 6c5e6b702..53a6f5ace 100644 --- a/src/plugins/General/converter/translations/converter_plugin_nl.ts +++ b/src/plugins/General/converter/translations/converter_plugin_nl.ts @@ -4,12 +4,12 @@ Converter - + Track: %1 - + Preset: %1 @@ -47,92 +47,92 @@ - + Choose a directory Kies een map - + Artist Artiest - + Album Album - + Title Naam - + Track number Liednummer - + Two-digit track number Twee-getal liednummer - + Genre Genre - + Comment Commentaar - + Composer Componist - + Duration Duur - + Disc number CD nummer - + File name Bestandsnaam - + Create a copy - + Year Jaar - + Condition Staat - + Create - + Edit - + Delete diff --git a/src/plugins/General/converter/translations/converter_plugin_pl.ts b/src/plugins/General/converter/translations/converter_plugin_pl.ts index 616295a83..b0ec298ac 100644 --- a/src/plugins/General/converter/translations/converter_plugin_pl.ts +++ b/src/plugins/General/converter/translations/converter_plugin_pl.ts @@ -4,12 +4,12 @@ Converter - + Track: %1 - + Preset: %1 @@ -47,92 +47,92 @@ - + Choose a directory Wybierz katalog - + Artist Artysta - + Album Album - + Title Tytuł - + Track number Numer utworu - + Two-digit track number Dwucyfrowy numer utworu - + Genre Gatunek - + Comment Komentarz - + Composer Kompozytor - + Duration Długość - + Disc number Numer płyty - + File name Nazwa pliku - + Create a copy - + Year Rok - + Condition Warunek - + Create - + Edit - + Delete diff --git a/src/plugins/General/converter/translations/converter_plugin_ru.ts b/src/plugins/General/converter/translations/converter_plugin_ru.ts index b216a47d4..4c5f4c84e 100644 --- a/src/plugins/General/converter/translations/converter_plugin_ru.ts +++ b/src/plugins/General/converter/translations/converter_plugin_ru.ts @@ -4,12 +4,12 @@ Converter - + Track: %1 Трек: %1 - + Preset: %1 Предустановка: %1 @@ -47,92 +47,92 @@ Перезаписывать существующие файлы - + Choose a directory Выберите директорию - + Artist Исполнитель - + Album Альбом - + Title Название - + Track number Номер трека - + Two-digit track number 2-х разрядный номер трека - + Genre Жанр - + Comment Комментарий - + Composer Композитор - + Duration Длительность - + Disc number Номер диска - + File name Имя файла - + Create a copy Создать копию - + Year Год - + Condition Условие - + Create Создать - + Edit Изменить - + Delete Удалить diff --git a/src/plugins/General/converter/translations/converter_plugin_tr.ts b/src/plugins/General/converter/translations/converter_plugin_tr.ts index 4367795ad..6017e4dde 100644 --- a/src/plugins/General/converter/translations/converter_plugin_tr.ts +++ b/src/plugins/General/converter/translations/converter_plugin_tr.ts @@ -4,12 +4,12 @@ Converter - + Track: %1 - + Preset: %1 @@ -47,92 +47,92 @@ - + Choose a directory Dizin seç - + Artist - + Album - + Title - + Track number - + Two-digit track number - + Genre - + Comment Yorum - + Composer - + Duration - + Disc number - + File name - + Create a copy - + Year Yıl - + Condition - + Create - + Edit - + Delete diff --git a/src/plugins/General/converter/translations/converter_plugin_uk_UA.ts b/src/plugins/General/converter/translations/converter_plugin_uk_UA.ts index 5e70d171a..2a5de0d8a 100644 --- a/src/plugins/General/converter/translations/converter_plugin_uk_UA.ts +++ b/src/plugins/General/converter/translations/converter_plugin_uk_UA.ts @@ -4,12 +4,12 @@ Converter - + Track: %1 - + Preset: %1 @@ -47,92 +47,92 @@ Переписати існуючі файли - + Choose a directory Виберіть теку - + Artist Виконавець - + Album Альбом - + Title Назва - + Track number Номер трека - + Two-digit track number 2-розрядний номер трека - + Genre Жанр - + Comment Коментар - + Composer Композитор - + Duration Тривалість - + Disc number Номер диска - + File name Ім'я файла - + Create a copy Створити копію - + Year Рік - + Condition Умова - + Create Створити - + Edit Редагувати - + Delete Видалити diff --git a/src/plugins/General/converter/translations/converter_plugin_zh_CN.ts b/src/plugins/General/converter/translations/converter_plugin_zh_CN.ts index 2c9c5d762..0bbcdb37b 100644 --- a/src/plugins/General/converter/translations/converter_plugin_zh_CN.ts +++ b/src/plugins/General/converter/translations/converter_plugin_zh_CN.ts @@ -4,12 +4,12 @@ Converter - + Track: %1 - + Preset: %1 @@ -47,92 +47,92 @@ - + Choose a directory 选择一个目录 - + Artist 艺术家 - + Album 专辑 - + Title 标题 - + Track number 音轨编号 - + Two-digit track number 两位数音轨编号 - + Genre 流派 - + Comment 备注 - + Composer 作曲 - + Duration 持续时间 - + Disc number 光盘编号 - + File name 文件名 - + Create a copy - + Year 年代 - + Condition 条件 - + Create - + Edit - + Delete diff --git a/src/plugins/General/converter/translations/converter_plugin_zh_TW.ts b/src/plugins/General/converter/translations/converter_plugin_zh_TW.ts index 98b464f16..f0f836af2 100644 --- a/src/plugins/General/converter/translations/converter_plugin_zh_TW.ts +++ b/src/plugins/General/converter/translations/converter_plugin_zh_TW.ts @@ -4,12 +4,12 @@ Converter - + Track: %1 - + Preset: %1 @@ -47,92 +47,92 @@ - + Choose a directory 選取一個目錄 - + Artist 藝術家 - + Album 專輯 - + Title 標題 - + Track number 音軌編號 - + Two-digit track number 兩位數音軌編號 - + Genre 流派 - + Comment 備註 - + Composer 作曲 - + Duration 持續時間 - + Disc number 光槃編號 - + File name 文件名 - + Create a copy - + Year 年代 - + Condition 條件 - + Create - + Edit - + Delete -- cgit v1.2.3-13-gbd6f