From 43bf74b188eec00b88435e68567da94e14cb3f5e Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Mon, 27 Jul 2009 13:24:37 +0000 Subject: added 'remove invalid files' action' git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1084 90c681e8-e032-0410-971d-27865f9a5e38 --- src/qmmpui/playlistmodel.cpp | 16 ++++++++++ src/qmmpui/playlistmodel.h | 8 +++++ src/ui/playlist.cpp | 3 ++ src/ui/translations/qmmp_cs.ts | 61 +++++++++++++++++++++------------------ src/ui/translations/qmmp_de.ts | 61 +++++++++++++++++++++------------------ src/ui/translations/qmmp_it.ts | 61 +++++++++++++++++++++------------------ src/ui/translations/qmmp_lt.ts | 61 +++++++++++++++++++++------------------ src/ui/translations/qmmp_pl_PL.ts | 61 +++++++++++++++++++++------------------ src/ui/translations/qmmp_pt_BR.ts | 61 +++++++++++++++++++++------------------ src/ui/translations/qmmp_ru.ts | 61 +++++++++++++++++++++------------------ src/ui/translations/qmmp_tr.ts | 61 +++++++++++++++++++++------------------ src/ui/translations/qmmp_uk_UA.ts | 61 +++++++++++++++++++++------------------ src/ui/translations/qmmp_zh_CN.ts | 61 +++++++++++++++++++++------------------ src/ui/translations/qmmp_zh_TW.ts | 61 +++++++++++++++++++++------------------ 14 files changed, 390 insertions(+), 308 deletions(-) (limited to 'src') diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp index 9049759a5..e0fc19ea3 100644 --- a/src/qmmpui/playlistmodel.cpp +++ b/src/qmmpui/playlistmodel.cpp @@ -286,6 +286,12 @@ void PlayListModel::removeAt (int i) } } +void PlayListModel::removeItem (PlayListItem *item) +{ + if(m_items.contains(item)) + removeAt (m_items.indexOf(item)); +} + void PlayListModel::removeSelection(bool inverted) { int i = 0; @@ -1004,3 +1010,13 @@ void PlayListModel::setFormat(const QString &format) PlaylistSettings::instance()->setFormat(format); emit settingsChanged(); } + +void PlayListModel::clearInvalidItems() +{ + foreach(PlayListItem *item, m_items) + { + if(!item->url().contains("://") && + !(QFile::exists(item->url()) && Decoder::supports(item->url()))) + removeItem(item); + } +} diff --git a/src/qmmpui/playlistmodel.h b/src/qmmpui/playlistmodel.h index b8a095a69..6b838f9c1 100644 --- a/src/qmmpui/playlistmodel.h +++ b/src/qmmpui/playlistmodel.h @@ -310,6 +310,10 @@ public slots: * Removes items with \b i index. */ void removeAt (int i); + /*! + * Removes item \b item from playlist + */ + void removeItem (PlayListItem *item); /*! * Inverts selection (selects unselected items and unselects selected items) */ @@ -417,6 +421,10 @@ public slots: * "%g" - genre, "%f" - file name, "%F" - full path, "%y" - year) */ void setFormat(const QString &format); + /*! + * Removes invalid items from playlist + */ + void clearInvalidItems(); private: /*! diff --git a/src/ui/playlist.cpp b/src/ui/playlist.cpp index dd454df38..b14caa9e2 100644 --- a/src/ui/playlist.cpp +++ b/src/ui/playlist.cpp @@ -169,6 +169,9 @@ void PlayList::createActions() connect (remUnselAct, SIGNAL (triggered()), m_playListModel, SLOT (removeUnselected ())); + m_subMenu->addSeparator(); + m_subMenu->addAction (tr("Remove unavailable files"), m_playListModel, SLOT(clearInvalidItems())); + //listwidget menu QAction *detailsAct = new QAction (tr ("&View Track Details"),this); detailsAct->setShortcut (tr ("Alt+I")); diff --git a/src/ui/translations/qmmp_cs.ts b/src/ui/translations/qmmp_cs.ts index 3fc230d23..305a41158 100644 --- a/src/ui/translations/qmmp_cs.ts +++ b/src/ui/translations/qmmp_cs.ts @@ -1022,105 +1022,110 @@ + Remove unavailable files + + + + &View Track Details Zobrazit &informace o skladbě - + Alt+I Alt+I - + Sort List Seřadit seznam - - + + By Title Podle názvu skladby - - + + By Filename Podle názvu souboru - - + + By Path + Filename Podle cesty a názvu souboru - - + + By Date Podle data - + Sort Selection Seřadit výběr - + Randomize List Zamíchat seznam - + Reverse List Obrátit pořadí seznamu - + Invert Selection Invertovat výběr - + &Select None &Zrušit výběr - + &Select All &Vybrat vše - + Ctrl+A Ctrl+A - + &New List &Nový seznam - + Shift+N Shift+N - + &Load List Načíst &seznam - + O O - + &Save List &Uložit seznam - + Shift+S Shift+S @@ -1135,23 +1140,23 @@ U - - + + By Track Number Podle čísla skladby - + &Queue &Fronta - + Q Q - + Actions Činnosti diff --git a/src/ui/translations/qmmp_de.ts b/src/ui/translations/qmmp_de.ts index 373e27dfa..6f64fe0ae 100644 --- a/src/ui/translations/qmmp_de.ts +++ b/src/ui/translations/qmmp_de.ts @@ -1022,105 +1022,110 @@ + Remove unavailable files + + + + &View Track Details &Titeldetails anzeigen - + Alt+I Alt+I - + Sort List Wiedergabeliste sortieren - - + + By Title Nach Titel - - + + By Filename Nach Dateinamen - - + + By Path + Filename Nach Pfad + Dateinamen - - + + By Date Nach Datum - + Sort Selection Auswahl sortieren - + Randomize List Wiedergabeliste mischen - + Reverse List Wiedergabeliste umkehren - + Invert Selection Auswahl umkehren - + &Select None &Auswahl aufheben - + &Select All Alle aus&wählen - + Ctrl+A Strg+A - + &New List &Neue Wiedergabeliste - + Shift+N Umschalt+N - + &Load List Wiedergabeliste &laden - + O O - + &Save List Wiedergabeliste &speichern - + Shift+S Umschalt+S @@ -1135,23 +1140,23 @@ U - - + + By Track Number Nach Titelnummer - + &Queue &Warteschlange - + Q Q - + Actions Aktionen diff --git a/src/ui/translations/qmmp_it.ts b/src/ui/translations/qmmp_it.ts index 3b3802f0e..f253f491b 100644 --- a/src/ui/translations/qmmp_it.ts +++ b/src/ui/translations/qmmp_it.ts @@ -991,17 +991,17 @@ D - + Alt+I Alt+I - + Ctrl+A Ctrl+A - + O O @@ -1032,90 +1032,95 @@ + Remove unavailable files + + + + &View Track Details &Dettagli della traccia - + Sort List Rirdina la lista - - + + By Title Per titolo - - + + By Filename Per titolo del brano - - + + By Path + Filename per percorso più titolo del brano - - + + By Date Per data - + Sort Selection Riordina la selezione - + Randomize List Mescola i brnai della lista - + Reverse List Inverti la lista - + Invert Selection Inverti la selezione - + &Select None &Non scegliere alcun brano - + &Select All &Seleziona tutto - + &New List &Nuova lista - + Shift+N Shift+N - + &Load List &Carica lista - + &Save List &Salva lista - + Shift+S Shift+S @@ -1135,23 +1140,23 @@ U - - + + By Track Number Per numero di traccia - + &Queue &Metti in coda - + Q Q - + Actions Azioni diff --git a/src/ui/translations/qmmp_lt.ts b/src/ui/translations/qmmp_lt.ts index b4a2bde9d..358a94c75 100644 --- a/src/ui/translations/qmmp_lt.ts +++ b/src/ui/translations/qmmp_lt.ts @@ -995,17 +995,17 @@ - + Alt+I - + Ctrl+A - + O @@ -1036,90 +1036,95 @@ + Remove unavailable files + + + + &View Track Details &Takelio informacija - + Sort List Rūšiuoti - - + + By Title Pagal dainos pavadinimą - - + + By Filename Pagal bylos pavadinimą - - + + By Path + Filename Pagal kelią iki bylos - - + + By Date Pagal datą - + Sort Selection Rūšiuoti pasirinktus - + Randomize List Sumaišyti sąrašą - + Reverse List Apversti - + Invert Selection Invert Selection - + &Select None &Nepasirinkti nei vieno - + &Select All &Pasirinkti visus - + &New List &Naujas sąrašas - + Shift+N - + &Load List &Įkwlti sąrašą - + &Save List &Išsaugoti sąrašą - + Shift+S @@ -1139,23 +1144,23 @@ - - + + By Track Number Pagal takelio numerį - + &Queue &Į eilę - + Q - + Actions Veiksmai diff --git a/src/ui/translations/qmmp_pl_PL.ts b/src/ui/translations/qmmp_pl_PL.ts index 37ae1f560..65969a7c6 100644 --- a/src/ui/translations/qmmp_pl_PL.ts +++ b/src/ui/translations/qmmp_pl_PL.ts @@ -991,17 +991,17 @@ D - + Alt+I Alt+I - + Ctrl+A Ctrl+A - + O O @@ -1032,90 +1032,95 @@ + Remove unavailable files + + + + &View Track Details &Pokaż informacje o pliku - + Sort List Sortuj listę - - + + By Title Według nazwy - - + + By Filename Według nazwy pliku - - + + By Path + Filename Według Ścieżki + Nazwy pliku - - + + By Date Wg Daty - + Sort Selection Sortuj zaznaczone - + Randomize List Tasuj listę - + Reverse List Odwróć listę - + Invert Selection Odwróć zaznaczenie - + &Select None &Odznacz wszystkie - + &Select All &Zaznacz wszystkie - + &New List &Nowa lista - + Shift+N Shift+N - + &Load List &Ładuj listę - + &Save List &Zapisz listę - + Shift+S Shift+S @@ -1135,23 +1140,23 @@ U - - + + By Track Number Wg numeru utworu - + &Queue &Kolejkuj - + Q Q - + Actions Akcje diff --git a/src/ui/translations/qmmp_pt_BR.ts b/src/ui/translations/qmmp_pt_BR.ts index b63212a30..b2f64526e 100644 --- a/src/ui/translations/qmmp_pt_BR.ts +++ b/src/ui/translations/qmmp_pt_BR.ts @@ -987,17 +987,17 @@ - + Alt+I - + Ctrl+A - + O @@ -1028,90 +1028,95 @@ + Remove unavailable files + + + + &View Track Details &Ver detalhes da Faixa - + Sort List Classificar lista - - + + By Title Por Título - - + + By Filename Por Nome - - + + By Path + Filename Por Dirertório + Nome - - + + By Date Por Data - + Sort Selection Classificar por Seleção - + Randomize List Lista Eleatória - + Reverse List Lista Revertida - + Invert Selection Inverter Seleção - + &Select None &Nenhum selecionado - + &Select All &Selecionar tudo - + &New List &Nova lista - + Shift+N - + &Load List &Carregar lista - + &Save List &Salvar lista - + Shift+S @@ -1131,23 +1136,23 @@ - - + + By Track Number - + &Queue Na fila - + Q - + Actions diff --git a/src/ui/translations/qmmp_ru.ts b/src/ui/translations/qmmp_ru.ts index 4a36144b4..23d42f99b 100644 --- a/src/ui/translations/qmmp_ru.ts +++ b/src/ui/translations/qmmp_ru.ts @@ -991,17 +991,17 @@ - + Alt+I - + Ctrl+A - + O @@ -1032,90 +1032,95 @@ + Remove unavailable files + + + + &View Track Details &Информация - + Sort List Сортировать - - + + By Title По названию - - + + By Filename По имени файла - - + + By Path + Filename По пути и файлу - - + + By Date По дате - + Sort Selection Сортировать выделенное - + Randomize List Перемешать - + Reverse List Перевернуть - + Invert Selection Инвертировать выделение - + &Select None &Снять выделение - + &Select All &Выделить всё - + &New List &Новый лист - + Shift+N - + &Load List &Загрузить лист - + &Save List &Сохранить лист - + Shift+S @@ -1135,23 +1140,23 @@ - - + + By Track Number По номеру трека - + &Queue &В очередь - + Q - + Actions Действия diff --git a/src/ui/translations/qmmp_tr.ts b/src/ui/translations/qmmp_tr.ts index edc4e5e55..06a79adea 100644 --- a/src/ui/translations/qmmp_tr.ts +++ b/src/ui/translations/qmmp_tr.ts @@ -987,17 +987,17 @@ D - + Alt+I Alt+I - + Ctrl+A Ctrl+A - + O O @@ -1028,90 +1028,95 @@ + Remove unavailable files + + + + &View Track Details &Parça Detaylarını Göster - + Sort List Listeyi Sınıflandır - - + + By Title Başlığa Göre - - + + By Filename Dosya Adına Göre - - + + By Path + Filename Dosya Yolu + Dosya Adına Göre - - + + By Date Tarihe Göre - + Sort Selection Seçilenleri Sınıflandır - + Randomize List Rastgele Listele - + Reverse List Listeyi Ters Çevir - + Invert Selection Seçimi Tersine Çevir - + &Select None &Hiçbirini Seçme - + &Select All &Tümünü Seç - + &New List &Yeni Liste - + Shift+N Shift+N - + &Load List &Liste Yükle - + &Save List &Listeyi Kaydet - + Shift+S Shift+S @@ -1131,23 +1136,23 @@ U - - + + By Track Number Parça Numarasına Göre - + &Queue &Kuyruğa ekle - + Q Q - + Actions Eylemler diff --git a/src/ui/translations/qmmp_uk_UA.ts b/src/ui/translations/qmmp_uk_UA.ts index 0dba0ea55..5a0df32d5 100644 --- a/src/ui/translations/qmmp_uk_UA.ts +++ b/src/ui/translations/qmmp_uk_UA.ts @@ -991,17 +991,17 @@ - + Alt+I - + Ctrl+A - + O @@ -1032,90 +1032,95 @@ + Remove unavailable files + + + + &View Track Details &Інформація - + Sort List Сортувати - - + + By Title За назвою - - + + By Filename За ім'ям файлу - - + + By Path + Filename За шляхом та файлом - - + + By Date За датою - + Sort Selection Сортувати вибране - + Randomize List Перемішати - + Reverse List Перевернути - + Invert Selection Інвертувати вибране - + &Select None &Зняти виділення - + &Select All &Вибрати все - + &New List &Новий список - + Shift+N - + &Load List &Завантажити список - + &Save List &Зберегти список - + Shift+S @@ -1135,23 +1140,23 @@ - - + + By Track Number - + &Queue &В чергу - + Q - + Actions Дії diff --git a/src/ui/translations/qmmp_zh_CN.ts b/src/ui/translations/qmmp_zh_CN.ts index cbb57b52f..eb2794a7e 100644 --- a/src/ui/translations/qmmp_zh_CN.ts +++ b/src/ui/translations/qmmp_zh_CN.ts @@ -991,17 +991,17 @@ D - + Alt+I Alt+I - + Ctrl+A Ctrl+A - + O O @@ -1032,90 +1032,95 @@ + Remove unavailable files + + + + &View Track Details 查看音轨详细信息(&V) - + Sort List 列表排序 - - + + By Title 按标题 - - + + By Filename 按文件名 - - + + By Path + Filename 按路径+文件名 - - + + By Date 按日期 - + Sort Selection 选择排序 - + Randomize List 随机产生列表 - + Reverse List 逆序列表 - + Invert Selection 反选 - + &Select None 无选择(&S) - + &Select All 选择全部(&S) - + &New List 新建列表(&N) - + Shift+N Shift+N - + &Load List 载入列表(&L) - + &Save List 保存列表(&S) - + Shift+S Shift+S @@ -1135,23 +1140,23 @@ U - - + + By Track Number 按音轨 - + &Queue 队列(&Q) - + Q Q - + Actions 动作 diff --git a/src/ui/translations/qmmp_zh_TW.ts b/src/ui/translations/qmmp_zh_TW.ts index a785f93d3..ea86dc892 100644 --- a/src/ui/translations/qmmp_zh_TW.ts +++ b/src/ui/translations/qmmp_zh_TW.ts @@ -991,17 +991,17 @@ D - + Alt+I Alt+I - + Ctrl+A Ctrl+A - + O O @@ -1032,90 +1032,95 @@ + Remove unavailable files + + + + &View Track Details 檢視音軌詳細資訊(&V) - + Sort List 清單排序 - - + + By Title 按標題 - - + + By Filename 按檔名 - - + + By Path + Filename 按路徑+檔名 - - + + By Date 按日期 - + Sort Selection 選取排序 - + Randomize List 隨機產生清單 - + Reverse List 逆串列表 - + Invert Selection 反選 - + &Select None 無選取(&S) - + &Select All 選取全部(&S) - + &New List 新建清單(&N) - + Shift+N Shift+N - + &Load List 載入清單(&L) - + &Save List 儲存清單(&S) - + Shift+S Shift+S @@ -1135,23 +1140,23 @@ U - - + + By Track Number 按音軌 - + &Queue 佇列(&Q) - + Q Q - + Actions 動作 -- cgit v1.2.3-13-gbd6f