diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9a9d2c05c..525ad41c4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -35,6 +35,7 @@ set(SOURCES core/backgroundthread.cpp core/commandlineoptions.cpp core/database.cpp + core/deletefiles.cpp core/filesystemmusicstorage.cpp core/fht.cpp core/globalshortcutbackend.cpp @@ -171,6 +172,7 @@ set(HEADERS core/albumcoverloader.h core/backgroundthread.h core/database.h + core/deletefiles.h core/globalshortcuts.h core/gnomeglobalshortcutbackend.h core/mergedproxymodel.h diff --git a/src/core/deletefiles.cpp b/src/core/deletefiles.cpp new file mode 100644 index 000000000..09bd17c6a --- /dev/null +++ b/src/core/deletefiles.cpp @@ -0,0 +1,99 @@ +/* This file is part of Clementine. + + Clementine is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Clementine is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Clementine. If not, see . +*/ + +#include "deletefiles.h" +#include "musicstorage.h" +#include "taskmanager.h" + +#include +#include +#include + +const int DeleteFiles::kBatchSize = 50; + +DeleteFiles::DeleteFiles(TaskManager* task_manager, MusicStorage* storage) + : thread_(NULL), + task_manager_(task_manager), + storage_(storage), + started_(false), + task_id_(0), + progress_(0) +{ + original_thread_ = thread(); +} + +void DeleteFiles::Start(const SongList& songs) { + if (thread_) + return; + + songs_ = songs; + + task_id_ = task_manager_->StartTask(tr("Deleting files")); + task_manager_->SetTaskBlocksLibraryScans(true); + + thread_ = new QThread; + connect(thread_, SIGNAL(started()), SLOT(ProcessSomeFiles())); + + moveToThread(thread_); + thread_->start(); +} + +void DeleteFiles::Start(const QStringList& filenames) { + SongList songs; + foreach (const QString& filename, filenames) { + Song song; + song.set_filename(filename); + songs << song; + } + + Start(songs); +} + +void DeleteFiles::ProcessSomeFiles() { + if (!started_) { + storage_->StartDelete(); + started_ = true; + } + + // None left? + if (progress_ >= songs_.count()) { + task_manager_->SetTaskProgress(task_id_, progress_, songs_.count()); + + storage_->FinishCopy(); + + task_manager_->SetTaskFinished(task_id_); + + // Move back to the original thread so deleteLater() can get called in + // the main thread's event loop + moveToThread(original_thread_); + deleteLater(); + + // Stop this thread + thread_->quit(); + return; + } + + // We process files in batches so we can be cancelled part-way through. + + const int n = qMin(songs_.count(), progress_ + kBatchSize); + for ( ; progress_SetTaskProgress(task_id_, progress_, songs_.count()); + + storage_->DeleteFromStorage(songs_.at(progress_)); + } + + QTimer::singleShot(0, this, SLOT(ProcessSomeFiles())); +} diff --git a/src/core/deletefiles.h b/src/core/deletefiles.h new file mode 100644 index 000000000..4010d5a89 --- /dev/null +++ b/src/core/deletefiles.h @@ -0,0 +1,55 @@ +/* This file is part of Clementine. + + Clementine is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Clementine is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Clementine. If not, see . +*/ + +#ifndef DELETEFILES_H +#define DELETEFILES_H + +#include + +#include "song.h" + +class MusicStorage; +class TaskManager; + +class DeleteFiles : public QObject { + Q_OBJECT + +public: + DeleteFiles(TaskManager* task_manager, MusicStorage* storage); + + static const int kBatchSize; + + void Start(const SongList& songs); + void Start(const QStringList& filenames); + +private slots: + void ProcessSomeFiles(); + +private: + QThread* thread_; + QThread* original_thread_; + TaskManager* task_manager_; + MusicStorage* storage_; + + SongList songs_; + + bool started_; + + int task_id_; + int progress_; +}; + +#endif // DELETEFILES_H diff --git a/src/core/filesystemmusicstorage.cpp b/src/core/filesystemmusicstorage.cpp index 8965013fb..dceff5607 100644 --- a/src/core/filesystemmusicstorage.cpp +++ b/src/core/filesystemmusicstorage.cpp @@ -47,3 +47,7 @@ bool FilesystemMusicStorage::CopyToStorage( else return QFile::copy(source, dest_filename); } + +bool FilesystemMusicStorage::DeleteFromStorage(const Song& metadata) { + return QFile::remove(metadata.filename()); +} diff --git a/src/core/filesystemmusicstorage.h b/src/core/filesystemmusicstorage.h index 4e98a441d..7d4f7fd79 100644 --- a/src/core/filesystemmusicstorage.h +++ b/src/core/filesystemmusicstorage.h @@ -28,6 +28,7 @@ public: bool CopyToStorage(const QString &source, const QString &destination, const Song &metadata, bool overwrite, bool remove_original); + bool DeleteFromStorage(const Song& metadata); private: QString root_; diff --git a/src/core/musicstorage.h b/src/core/musicstorage.h index 4706622a0..d53f4b00b 100644 --- a/src/core/musicstorage.h +++ b/src/core/musicstorage.h @@ -39,6 +39,11 @@ public: const Song& metadata, bool overwrite, bool remove_original) = 0; virtual void FinishCopy() {} + + virtual void StartDelete() {} + virtual bool DeleteFromStorage(const Song& metadata) = 0; + virtual void FinishDelete() {} + virtual void Eject() {} }; diff --git a/src/devices/deviceview.cpp b/src/devices/deviceview.cpp index 0bdb39810..26159af65 100644 --- a/src/devices/deviceview.cpp +++ b/src/devices/deviceview.cpp @@ -18,6 +18,7 @@ #include "devicemanager.h" #include "deviceproperties.h" #include "deviceview.h" +#include "core/deletefiles.h" #include "core/mergedproxymodel.h" #include "library/librarydirectorymodel.h" #include "library/librarymodel.h" @@ -206,6 +207,14 @@ QModelIndex DeviceView::MapToDevice(const QModelIndex& merged_model_index) const return sort_model_->mapToSource(sort_model_index); } +QModelIndex DeviceView::FindParentDevice(const QModelIndex& merged_model_index) const { + QModelIndex index = merged_model_->FindSourceParent(merged_model_index); + if (index.model() != sort_model_) + return QModelIndex(); + + return sort_model_->mapToSource(index); +} + QModelIndex DeviceView::MapToLibrary(const QModelIndex& merged_model_index) const { QModelIndex sort_model_index = merged_model_->mapToSource(merged_model_index); if (const QSortFilterProxyModel* sort_model = @@ -323,7 +332,23 @@ void DeviceView::AddToPlaylist() { } void DeviceView::Delete() { + if (selectedIndexes().isEmpty()) + return; + // Take the device of the first selected item + QModelIndex device_index = FindParentDevice(selectedIndexes()[0]); + if (!device_index.isValid()) + return; + + if (QMessageBox::question(this, tr("Delete files"), + tr("These files will be deleted from the device, are you sure you want to continue?"), + QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes) + return; + + MusicStorage* storage = device_index.data(MusicStorage::Role_Storage).value(); + + DeleteFiles* delete_files = new DeleteFiles(manager_->task_manager(), storage); + delete_files->Start(GetSelectedSongs()); } void DeviceView::Organise() { diff --git a/src/devices/deviceview.h b/src/devices/deviceview.h index 044cdb5eb..e9de72a9e 100644 --- a/src/devices/deviceview.h +++ b/src/devices/deviceview.h @@ -78,6 +78,7 @@ private slots: private: QModelIndex MapToDevice(const QModelIndex& merged_model_index) const; QModelIndex MapToLibrary(const QModelIndex& merged_model_index) const; + QModelIndex FindParentDevice(const QModelIndex& merged_model_index) const; SongList GetSelectedSongs() const; private: diff --git a/src/devices/gpoddevice.cpp b/src/devices/gpoddevice.cpp index 53b866b70..5de0b7d5e 100644 --- a/src/devices/gpoddevice.cpp +++ b/src/devices/gpoddevice.cpp @@ -67,7 +67,7 @@ void GPodDevice::StartCopy() { } // Ensure only one "organise files" can be active at any one time - copy_in_progress_.lock(); + db_busy_.lock(); } bool GPodDevice::CopyToStorage( @@ -128,6 +128,55 @@ void GPodDevice::FinishCopy() { } songs_to_add_.clear(); - copy_in_progress_.unlock(); + db_busy_.unlock(); +} + +void GPodDevice::StartDelete() { + StartCopy(); +} + +bool GPodDevice::DeleteFromStorage(const Song& metadata) { + Q_ASSERT(db_); + + // Find the track in the itdb, identify it by its filename + Itdb_Track* track = NULL; + for (GList* tracks = db_->tracks ; tracks != NULL ; tracks = tracks->next) { + Itdb_Track* t = static_cast(tracks->data); + + itdb_filename_ipod2fs(t->ipod_path); + if (url_.path() + t->ipod_path == metadata.filename()) { + track = t; + break; + } + } + + if (track == NULL) { + qWarning() << "Couldn't find song" << metadata.filename() << "in iTunesDB"; + return false; + } + + // Remove the track from all playlists + for (GList* playlists = db_->playlists ; playlists != NULL ; playlists = playlists->next) { + Itdb_Playlist* playlist = static_cast(playlists->data); + + if (itdb_playlist_contains_track(playlist, track)) { + itdb_playlist_remove_track(playlist, track); + } + } + + // Remove the track from the database, this frees the struct too + itdb_track_remove(track); + + // Remove the file + QFile::remove(metadata.filename()); + + // Remove it from our library model + backend_->DeleteSongs(SongList() << metadata); + + return true; +} + +void GPodDevice::FinishDelete() { + FinishCopy(); } diff --git a/src/devices/gpoddevice.h b/src/devices/gpoddevice.h index 3e66085be..f5c49160e 100644 --- a/src/devices/gpoddevice.h +++ b/src/devices/gpoddevice.h @@ -44,6 +44,10 @@ public: const Song &metadata, bool overwrite, bool remove_original); void FinishCopy(); + void StartDelete(); + bool DeleteFromStorage(const Song& metadata); + void FinishDelete(); + private slots: void LoadFinished(Itdb_iTunesDB* db); @@ -55,7 +59,7 @@ private: QMutex db_mutex_; Itdb_iTunesDB* db_; - QMutex copy_in_progress_; + QMutex db_busy_; SongList songs_to_add_; }; diff --git a/src/library/libraryview.cpp b/src/library/libraryview.cpp index 87f938528..a3669eab5 100644 --- a/src/library/libraryview.cpp +++ b/src/library/libraryview.cpp @@ -19,6 +19,8 @@ #include "libraryview.h" #include "libraryitem.h" #include "librarybackend.h" +#include "core/deletefiles.h" +#include "core/musicstorage.h" #include "devices/devicemanager.h" #include "devices/devicestatefiltermodel.h" #include "ui/iconloader.h" @@ -27,6 +29,7 @@ #include #include #include +#include #include #include @@ -105,8 +108,6 @@ LibraryView::LibraryView(QWidget* parent) no_show_in_various_ = context_menu_->addAction( tr("Don't show in various artists"), this, SLOT(NoShowInVarious())); - delete_->setVisible(false); // TODO - ReloadSettings(); } @@ -121,6 +122,7 @@ void LibraryView::ReloadSettings() { } void LibraryView::SetTaskManager(TaskManager *task_manager) { + task_manager_ = task_manager; organise_dialog_.reset(new OrganiseDialog(task_manager)); } @@ -251,19 +253,25 @@ void LibraryView::scrollTo(const QModelIndex &index, ScrollHint hint) { } void LibraryView::GetSelectedFileInfo( - QStringList *filenames, quint64 *size) const { + QStringList *filenames, quint64 *size, SongList* songs_out) const { QModelIndexList selected_indexes = qobject_cast(model())->mapSelectionToSource( selectionModel()->selection()).indexes(); SongList songs = library_->GetChildSongs(selected_indexes); - *size = 0; - foreach (const Song& song, songs) { - *filenames << song.filename(); + if (size) + *size = 0; - if (song.filesize() >= 0) + foreach (const Song& song, songs) { + if (filenames) + *filenames << song.filename(); + + if (size && song.filesize() >= 0) *size += song.filesize(); } + + if (songs_out) + *songs_out = songs; } void LibraryView::Organise() { @@ -278,7 +286,24 @@ void LibraryView::Organise() { } void LibraryView::Delete() { + SongList songs; + GetSelectedFileInfo(NULL, NULL, &songs); + if (songs.isEmpty()) + return; + + if (QMessageBox::question(this, tr("Delete files"), + tr("These files will be deleted from disk, are you sure you want to continue?"), + QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes) + return; + + // We can cheat and always take the storage of the first directory, since + // they'll all be FilesystemMusicStorage in a library and deleting doesn't + // check the actual directory. + MusicStorage* storage = library_->directory_model()->index(0, 0).data( + MusicStorage::Role_Storage).value(); + DeleteFiles* delete_files = new DeleteFiles(task_manager_, storage); + delete_files->Start(songs); } void LibraryView::CopyToDevice() { diff --git a/src/library/libraryview.h b/src/library/libraryview.h index 96493d16d..f4bbe35ba 100644 --- a/src/library/libraryview.h +++ b/src/library/libraryview.h @@ -17,6 +17,7 @@ #ifndef LIBRARYVIEW_H #define LIBRARYVIEW_H +#include "core/song.h" #include "widgets/autoexpandingtreeview.h" #include @@ -78,11 +79,12 @@ class LibraryView : public AutoExpandingTreeView { private: void RecheckIsEmpty(); void ShowInVarious(bool on); - void GetSelectedFileInfo(QStringList* filenames, quint64* size) const; + void GetSelectedFileInfo(QStringList* filenames, quint64* size, SongList* songs = NULL) const; private: LibraryModel* library_; DeviceManager* devices_; + TaskManager* task_manager_; int total_song_count_; diff --git a/src/translations/ar.po b/src/translations/ar.po index 7e0b27a22..c5ac36b8e 100644 --- a/src/translations/ar.po +++ b/src/translations/ar.po @@ -473,6 +473,9 @@ msgstr "" msgid "Delay between visualizations" msgstr "" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "" @@ -488,6 +491,9 @@ msgstr "" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1534,6 +1540,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "سيتم فحص الملفات الصوتية الموجودة في هذه الملفات لإضافتها لمكتبتك" diff --git a/src/translations/bg.po b/src/translations/bg.po index 82ed89e78..e5eecc052 100644 --- a/src/translations/bg.po +++ b/src/translations/bg.po @@ -473,6 +473,9 @@ msgstr "" msgid "Delay between visualizations" msgstr "" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "" @@ -488,6 +491,9 @@ msgstr "" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1534,6 +1540,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" diff --git a/src/translations/cs.po b/src/translations/cs.po index 3242435de..1bf0aef9e 100644 --- a/src/translations/cs.po +++ b/src/translations/cs.po @@ -474,6 +474,9 @@ msgstr "Snížit hlasitost" msgid "Delay between visualizations" msgstr "" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "" @@ -489,6 +492,9 @@ msgstr "Smazat předvolbu" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1538,6 +1544,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "Tyto složky budou prohledány a nalezená hudba bude přidána do knihovny" diff --git a/src/translations/da.po b/src/translations/da.po index 0070bf6e5..fa247bf0e 100644 --- a/src/translations/da.po +++ b/src/translations/da.po @@ -474,6 +474,9 @@ msgstr "" msgid "Delay between visualizations" msgstr "" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "" @@ -489,6 +492,9 @@ msgstr "Slet forudindstilling" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1541,6 +1547,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "Disse mapper vil blive scannet for musik til at opbygget dit bibliotek" diff --git a/src/translations/de.po b/src/translations/de.po index b5b60929b..2cd294d56 100644 --- a/src/translations/de.po +++ b/src/translations/de.po @@ -482,6 +482,9 @@ msgstr "Lautstärke verringern" msgid "Delay between visualizations" msgstr "Verzögerung zwischen Visualisierungen" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "Dateien löschen..." @@ -497,6 +500,9 @@ msgstr "Voreinstellung löschen" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "Stücke aus der Warteschlange nehmen" @@ -1553,6 +1559,15 @@ msgstr "Die Wiedergabeliste \"%1\" ist leer oder konnte nicht geladen werden." msgid "There was a problem fetching the metadata from Magnatune" msgstr "Beim Holen der Metadaten von Magnatune ist ein Fehler aufgetreten" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "Diese Ordner werden für Ihre Musiksammlung durchsucht" diff --git a/src/translations/el.po b/src/translations/el.po index c98f1cc35..1cfc47a03 100644 --- a/src/translations/el.po +++ b/src/translations/el.po @@ -485,6 +485,9 @@ msgstr "Μείωση έντασης" msgid "Delay between visualizations" msgstr "Καθυστέρηση μεταξύ οπτικών εφέ" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "Διαγραφή αρχείων..." @@ -500,6 +503,9 @@ msgstr "Διαγραφή ρύθμισης" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "Αφαίρεση των επιλεγμένων κομματιών από την λίστα αναμονής" @@ -1556,6 +1562,15 @@ msgid "There was a problem fetching the metadata from Magnatune" msgstr "" "Υπήρξε κάποιο σφάλμα κατά την μεταφορά των μετα-δεδομένων από το Magnatune" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "Οι φάκελοι αυτοί θα σαρωθούν για μουσικά αρχεία για την βιβλιοθήκη σας" diff --git a/src/translations/en_CA.po b/src/translations/en_CA.po index b32aacd7a..41be40adc 100644 --- a/src/translations/en_CA.po +++ b/src/translations/en_CA.po @@ -475,6 +475,9 @@ msgstr "Decrease volume" msgid "Delay between visualizations" msgstr "Delay between visualisations" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "" @@ -490,6 +493,9 @@ msgstr "Delete preset" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1539,6 +1545,15 @@ msgstr "The playlist '%1' was empty or could not be loaded." msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "These folders will be scanned for music to make up your library" diff --git a/src/translations/en_GB.po b/src/translations/en_GB.po index bfadf114e..957ea847f 100644 --- a/src/translations/en_GB.po +++ b/src/translations/en_GB.po @@ -473,6 +473,9 @@ msgstr "" msgid "Delay between visualizations" msgstr "Delay between visualisations" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "" @@ -488,6 +491,9 @@ msgstr "Delete preset" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1536,6 +1542,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "These folders will be scanned for music to make up your library" diff --git a/src/translations/es.po b/src/translations/es.po index 8e723bc3e..98923f692 100644 --- a/src/translations/es.po +++ b/src/translations/es.po @@ -485,6 +485,9 @@ msgstr "Disminuir volumen" msgid "Delay between visualizations" msgstr "Retardo entre visualizaciones" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "Eliminar archivos..." @@ -500,6 +503,9 @@ msgstr "Eliminar predefinición" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1559,6 +1565,15 @@ msgstr "La lista de reproducción '%1' estaba vacía o no pudo ser cargada." msgid "There was a problem fetching the metadata from Magnatune" msgstr "Hubo un problema obteniendo los metadatos desde Magnatune" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" "Estas carpetas serán analizadas en busca de música para crear su colección" diff --git a/src/translations/fi.po b/src/translations/fi.po index cf783ffa9..1806f8466 100644 --- a/src/translations/fi.po +++ b/src/translations/fi.po @@ -473,6 +473,9 @@ msgstr "Vähennä äänenvoimakkuutta" msgid "Delay between visualizations" msgstr "" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "Poista tiedostot..." @@ -488,6 +491,9 @@ msgstr "" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1536,6 +1542,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" diff --git a/src/translations/fr.po b/src/translations/fr.po index 8b2732e40..85524bf1d 100644 --- a/src/translations/fr.po +++ b/src/translations/fr.po @@ -478,6 +478,9 @@ msgstr "Diminuer le volume" msgid "Delay between visualizations" msgstr "Délai entre les visualisations" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "Supprimer les fichiers…" @@ -493,6 +496,9 @@ msgstr "Effacer le pré-réglage" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "Enlever les pistes sélectionnées de la file d'attente" @@ -1546,6 +1552,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" "Ces dossiers seront analysés pour trouver les fichiers qui constitueront " diff --git a/src/translations/gl.po b/src/translations/gl.po index 733f46069..b5d936e05 100644 --- a/src/translations/gl.po +++ b/src/translations/gl.po @@ -473,6 +473,9 @@ msgstr "" msgid "Delay between visualizations" msgstr "" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "" @@ -488,6 +491,9 @@ msgstr "Eliminar predefinido" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1536,6 +1542,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" diff --git a/src/translations/it.po b/src/translations/it.po index 16f6ddd9c..3fe6610c7 100644 --- a/src/translations/it.po +++ b/src/translations/it.po @@ -484,6 +484,9 @@ msgstr "Riduci il volume" msgid "Delay between visualizations" msgstr "Ritardo tra le visualizzazioni" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "Elimina file..." @@ -499,6 +502,9 @@ msgstr "Elimina la preimpostazione" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "Rimuovi le tracce selezionate dalla coda" @@ -1560,6 +1566,15 @@ msgstr "" "Si è verificato un problema durante il recupero dei dati aggiuntivi da " "Magnatune" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" "Queste cartelle saranno analizzate alla ricerca di musica per creare la tua " diff --git a/src/translations/kk.po b/src/translations/kk.po index 8916fcc7e..0226e4383 100644 --- a/src/translations/kk.po +++ b/src/translations/kk.po @@ -473,6 +473,9 @@ msgstr "" msgid "Delay between visualizations" msgstr "" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "" @@ -488,6 +491,9 @@ msgstr "" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1536,6 +1542,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" diff --git a/src/translations/lt.po b/src/translations/lt.po index beed1d83c..18b6ff065 100644 --- a/src/translations/lt.po +++ b/src/translations/lt.po @@ -473,6 +473,9 @@ msgstr "" msgid "Delay between visualizations" msgstr "" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "" @@ -488,6 +491,9 @@ msgstr "" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1534,6 +1540,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" diff --git a/src/translations/nb.po b/src/translations/nb.po index a88506575..0596a82b8 100644 --- a/src/translations/nb.po +++ b/src/translations/nb.po @@ -473,6 +473,9 @@ msgstr "" msgid "Delay between visualizations" msgstr "" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "" @@ -488,6 +491,9 @@ msgstr "Slett forhåndsinnstilling" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1537,6 +1543,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" "Disse katalogene vil skannes for musikk som kan legges til biblioteket ditt" diff --git a/src/translations/nl.po b/src/translations/nl.po index dc44fa54b..4a21dfb28 100644 --- a/src/translations/nl.po +++ b/src/translations/nl.po @@ -481,6 +481,9 @@ msgstr "Volume verlagen" msgid "Delay between visualizations" msgstr "Vertraging tussen visualisaties" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "Bestanden wissen..." @@ -496,6 +499,9 @@ msgstr "Voorinstelling verwijderen" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "Geselecteerde tracks uit wachtrij verwijderen" @@ -1554,6 +1560,15 @@ msgid "There was a problem fetching the metadata from Magnatune" msgstr "" "Er is een probleem opgetreden bij het ophalen van de metadata van Magnatune" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" "Deze mappen zullen worden doorzocht op muziek dat uw bibliotheek zal vormen" diff --git a/src/translations/oc.po b/src/translations/oc.po index 686aefc41..57e042edd 100644 --- a/src/translations/oc.po +++ b/src/translations/oc.po @@ -473,6 +473,9 @@ msgstr "Reduire lo volum" msgid "Delay between visualizations" msgstr "" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "" @@ -488,6 +491,9 @@ msgstr "Escafar un prereglatge" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1534,6 +1540,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" diff --git a/src/translations/pl.po b/src/translations/pl.po index e6df7f0f9..197cc9d37 100644 --- a/src/translations/pl.po +++ b/src/translations/pl.po @@ -479,6 +479,9 @@ msgstr "Zmniejsz głośność" msgid "Delay between visualizations" msgstr "Opóźnienie pomiędzy wizualizacjami" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "Usuń pliki..." @@ -494,6 +497,9 @@ msgstr "Usuń ustawienia korektora" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1545,6 +1551,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "Te katalogi będą skanowane w poszukiwaniu muzyki" diff --git a/src/translations/pt.po b/src/translations/pt.po index 9e691c9e4..51ab23cdc 100644 --- a/src/translations/pt.po +++ b/src/translations/pt.po @@ -482,6 +482,9 @@ msgstr "Diminuir volume" msgid "Delay between visualizations" msgstr "Atraso entre visualizações" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "Apagar ficheiros..." @@ -497,6 +500,9 @@ msgstr "Apagar pré-ajustes" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "Retiras da fila as faixas seleccionadas" @@ -1550,6 +1556,15 @@ msgstr "A lista de reprodução '%1' está vazia ou não pôde ser carregada." msgid "There was a problem fetching the metadata from Magnatune" msgstr "Ocorreu um problema ao obter os meta-dados Magnatune" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "Estas pastas irão ser analisadas para criar a sua biblioteca" diff --git a/src/translations/pt_BR.po b/src/translations/pt_BR.po index 8c8ed5d45..400ba67dc 100644 --- a/src/translations/pt_BR.po +++ b/src/translations/pt_BR.po @@ -478,6 +478,9 @@ msgstr "Diminuir volume" msgid "Delay between visualizations" msgstr "Atraso entre as visualizações" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "Remover arquivos..." @@ -493,6 +496,9 @@ msgstr "Apagar pré-regulagem" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1546,6 +1552,15 @@ msgstr "A lista de reprodução '%1' está vazia ou não pode ser carregada." msgid "There was a problem fetching the metadata from Magnatune" msgstr "Há um problema ao buscar o arquivo multimídia no Magnatune" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" "As pastas serão escaneadas em busca de músicas para montar sua biblioteca" diff --git a/src/translations/ro.po b/src/translations/ro.po index 08afe5192..14afbf06c 100644 --- a/src/translations/ro.po +++ b/src/translations/ro.po @@ -473,6 +473,9 @@ msgstr "" msgid "Delay between visualizations" msgstr "" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "" @@ -488,6 +491,9 @@ msgstr "Şterge presetări" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1535,6 +1541,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" diff --git a/src/translations/ru.po b/src/translations/ru.po index 3ab6d2ee6..e9c0737f1 100644 --- a/src/translations/ru.po +++ b/src/translations/ru.po @@ -480,6 +480,9 @@ msgstr "Уменьшить громкость" msgid "Delay between visualizations" msgstr "Задержка между визуализациями" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "Удалить файлы..." @@ -495,6 +498,9 @@ msgstr "Удалить настройку" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "Убрать из очереди выбранные композиции" @@ -1548,6 +1554,15 @@ msgstr "Список воспроизведения '%1' пуст или не м msgid "There was a problem fetching the metadata from Magnatune" msgstr "Проблема получения метаданных с Magnatune" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" "В этих каталогах будет выполнен поиск музыки для создания вашей коллекции" diff --git a/src/translations/sk.po b/src/translations/sk.po index 5884fac0b..510c4ea61 100644 --- a/src/translations/sk.po +++ b/src/translations/sk.po @@ -482,6 +482,9 @@ msgstr "Znížiť hlasitosť" msgid "Delay between visualizations" msgstr "Oneskorenie medzi vizualizáciami" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "Vymazať súbory..." @@ -497,6 +500,9 @@ msgstr "Vymazať predvoľbu" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "Vybrať z radu vybrané skladby" @@ -1549,6 +1555,15 @@ msgstr "Playlist '%1' je prázdny alebo nemôže byť načítaný." msgid "There was a problem fetching the metadata from Magnatune" msgstr "Nastal problém so získavaním metadát z Magnatune" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "Tieto priečinky budú prehľadané pre vytvorenie vyšej zbierky" diff --git a/src/translations/sr.po b/src/translations/sr.po index dcfddb384..e56a61090 100644 --- a/src/translations/sr.po +++ b/src/translations/sr.po @@ -475,6 +475,9 @@ msgstr "Утишај звук" msgid "Delay between visualizations" msgstr "Застој између визуелизација" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "Обриши фајлове...." @@ -490,6 +493,9 @@ msgstr "Обриши претподешавање" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "Избаци означене нумере из реда" @@ -1539,6 +1545,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" diff --git a/src/translations/sv.po b/src/translations/sv.po index a3a650e84..c5545d556 100644 --- a/src/translations/sv.po +++ b/src/translations/sv.po @@ -475,6 +475,9 @@ msgstr "Sänk volymen" msgid "Delay between visualizations" msgstr "" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "" @@ -490,6 +493,9 @@ msgstr "Ta bort förinställning" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1539,6 +1545,15 @@ msgstr "Spellistan '%1' var tom eller kunde inte läsas in." msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" "De här mapparna kommer genomsökas efter musik som skall vara med i ditt " diff --git a/src/translations/tr.po b/src/translations/tr.po index a0e5a9eda..d1ffcdc0b 100644 --- a/src/translations/tr.po +++ b/src/translations/tr.po @@ -473,6 +473,9 @@ msgstr "Sesi azalt" msgid "Delay between visualizations" msgstr "Görselleştirmeler arasındaki gecikme" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "Dosyaları sil..." @@ -488,6 +491,9 @@ msgstr "Ayarı sil" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1540,6 +1546,15 @@ msgstr "Çalma listesi '%1' boş veya yüklenemiyor." msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "Bu dosyalar kütüphaneni oluşturacak parçalar için taranacak" diff --git a/src/translations/translations.pot b/src/translations/translations.pot index aba9d54b3..a3017bdd7 100644 --- a/src/translations/translations.pot +++ b/src/translations/translations.pot @@ -463,6 +463,9 @@ msgstr "" msgid "Delay between visualizations" msgstr "" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "" @@ -478,6 +481,9 @@ msgstr "" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1524,6 +1530,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" diff --git a/src/translations/uk.po b/src/translations/uk.po index 1f837c1f7..593f0c8a1 100644 --- a/src/translations/uk.po +++ b/src/translations/uk.po @@ -481,6 +481,9 @@ msgstr "Зменшити гучність" msgid "Delay between visualizations" msgstr "Затримка між візуалізаціями" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "Вилучити файли..." @@ -496,6 +499,9 @@ msgstr "Стерти установки" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "Вилучити з черги вибрані доріжки" @@ -1549,6 +1555,15 @@ msgstr "Список відтворення '%1' порожній або нем msgid "There was a problem fetching the metadata from Magnatune" msgstr "Проблема отримання метаданих з Magnatune" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "В цих теках виконуватиметься пошук музики для створення фонотеки" diff --git a/src/translations/zh_CN.po b/src/translations/zh_CN.po index 705119758..69344294f 100644 --- a/src/translations/zh_CN.po +++ b/src/translations/zh_CN.po @@ -473,6 +473,9 @@ msgstr "降低音量" msgid "Delay between visualizations" msgstr "" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "" @@ -488,6 +491,9 @@ msgstr "" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1534,6 +1540,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "" diff --git a/src/translations/zh_TW.po b/src/translations/zh_TW.po index 94d83ae05..86c1a2375 100644 --- a/src/translations/zh_TW.po +++ b/src/translations/zh_TW.po @@ -477,6 +477,9 @@ msgstr "減低音量" msgid "Delay between visualizations" msgstr "在兩個視覺化效果間延遲切換" +msgid "Delete files" +msgstr "" + msgid "Delete files..." msgstr "刪除檔案" @@ -492,6 +495,9 @@ msgstr "刪除預置" msgid "Delete the original files" msgstr "" +msgid "Deleting files" +msgstr "" + msgid "Dequeue selected tracks" msgstr "" @@ -1539,6 +1545,15 @@ msgstr "" msgid "There was a problem fetching the metadata from Magnatune" msgstr "" +msgid "" +"These files will be deleted from disk, are you sure you want to continue?" +msgstr "" + +msgid "" +"These files will be deleted from the device, are you sure you want to " +"continue?" +msgstr "" + msgid "These folders will be scanned for music to make up your library" msgstr "這些檔案夾將被掃描是否有音樂檔,以建構你的音樂庫." diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index c484cef9f..2f73dbfad 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -243,6 +243,7 @@ MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidg connect(ui_->file_view, SIGNAL(PathChanged(QString)), SLOT(FilePathChanged(QString))); connect(ui_->file_view, SIGNAL(CopyToLibrary(QList)), SLOT(CopyFilesToLibrary(QList))); connect(ui_->file_view, SIGNAL(MoveToLibrary(QList)), SLOT(MoveFilesToLibrary(QList))); + ui_->file_view->SetTaskManager(task_manager_); // Cover manager connections connect(cover_manager_.get(), SIGNAL(AddSongsToPlaylist(SongList)), SLOT(AddLibrarySongsToPlaylist(SongList))); diff --git a/src/widgets/fileview.cpp b/src/widgets/fileview.cpp index ea94878ab..ff1bd29ad 100644 --- a/src/widgets/fileview.cpp +++ b/src/widgets/fileview.cpp @@ -16,16 +16,21 @@ #include "fileview.h" #include "ui_fileview.h" +#include "core/deletefiles.h" +#include "core/filesystemmusicstorage.h" #include "ui/iconloader.h" #include +#include #include FileView::FileView(QWidget* parent) : QWidget(parent), ui_(new Ui_FileView), model_(new QFileSystemModel(this)), - undo_stack_(new QUndoStack(this)) + undo_stack_(new QUndoStack(this)), + task_manager_(NULL), + storage_(new FilesystemMusicStorage("/")) { ui_->setupUi(this); @@ -53,16 +58,22 @@ FileView::FileView(QWidget* parent) connect(ui_->list, SIGNAL(AddToPlaylist(QList)), SIGNAL(AddToPlaylist(QList))); connect(ui_->list, SIGNAL(CopyToLibrary(QList)), SIGNAL(CopyToLibrary(QList))); connect(ui_->list, SIGNAL(MoveToLibrary(QList)), SIGNAL(MoveToLibrary(QList))); + connect(ui_->list, SIGNAL(Delete(QStringList)), SLOT(Delete(QStringList))); } FileView::~FileView() { delete ui_; + delete storage_; } void FileView::SetPath(const QString& path) { ChangeFilePathWithoutUndo(path); } +void FileView::SetTaskManager(TaskManager* task_manager) { + task_manager_ = task_manager; +} + void FileView::FileUp() { QDir dir(model_->rootDirectory()); dir.cdUp(); @@ -146,3 +157,16 @@ void FileView::UndoCommand::undo() { view_->ui_->list->setCurrentIndex(old_state_.index); view_->ui_->list->verticalScrollBar()->setValue(old_state_.scroll_pos); } + +void FileView::Delete(const QStringList& filenames) { + if (filenames.isEmpty()) + return; + + if (QMessageBox::question(this, tr("Delete files"), + tr("These files will be deleted from disk, are you sure you want to continue?"), + QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes) + return; + + DeleteFiles* delete_files = new DeleteFiles(task_manager_, storage_); + delete_files->Start(filenames); +} diff --git a/src/widgets/fileview.h b/src/widgets/fileview.h index c449c565d..45644e894 100644 --- a/src/widgets/fileview.h +++ b/src/widgets/fileview.h @@ -22,6 +22,8 @@ #include #include +class FilesystemMusicStorage; +class TaskManager; class Ui_FileView; class QFileSystemModel; @@ -35,6 +37,7 @@ class FileView : public QWidget { ~FileView(); void SetPath(const QString& path); + void SetTaskManager(TaskManager* task_manager); signals: void PathChanged(const QString& path); @@ -51,6 +54,7 @@ class FileView : public QWidget { void ChangeFilePath(const QString& new_path); void ItemActivated(const QModelIndex& index); void ItemDoubleClick(const QModelIndex& index); + void Delete(const QStringList& filenames); private: void ChangeFilePathWithoutUndo(const QString& new_path); @@ -83,6 +87,9 @@ class FileView : public QWidget { QFileSystemModel* model_; QUndoStack* undo_stack_; + + TaskManager* task_manager_; + FilesystemMusicStorage* storage_; }; #endif // FILEVIEW_H diff --git a/src/widgets/fileviewlist.cpp b/src/widgets/fileviewlist.cpp index e400ccae6..e1f38f026 100644 --- a/src/widgets/fileviewlist.cpp +++ b/src/widgets/fileviewlist.cpp @@ -35,6 +35,8 @@ FileViewList::FileViewList(QWidget* parent) this, SLOT(CopyToLibrarySlot())); menu_->addAction(IconLoader::Load("go-jump"), tr("Move to library..."), this, SLOT(MoveToLibrarySlot())); + menu_->addAction(IconLoader::Load("edit-delete"), tr("Delete from disk..."), + this, SLOT(DeleteSlot())); } void FileViewList::contextMenuEvent(QContextMenuEvent* e) { @@ -54,6 +56,15 @@ QList FileViewList::UrlListFromSelection() const { return urls; } +QStringList FileViewList::FilenamesFromSelection() const { + QStringList filenames; + foreach (const QModelIndex& index, menu_selection_.indexes()) { + if (index.column() == 0) + filenames << static_cast(model())->filePath(index); + } + return filenames; +} + void FileViewList::LoadSlot() { emit Load(UrlListFromSelection()); } @@ -69,3 +80,7 @@ void FileViewList::CopyToLibrarySlot() { void FileViewList::MoveToLibrarySlot() { emit MoveToLibrary(UrlListFromSelection()); } + +void FileViewList::DeleteSlot() { + emit Delete(FilenamesFromSelection()); +} diff --git a/src/widgets/fileviewlist.h b/src/widgets/fileviewlist.h index b0c0f45d8..6383ef374 100644 --- a/src/widgets/fileviewlist.h +++ b/src/widgets/fileviewlist.h @@ -31,6 +31,7 @@ class FileViewList : public QListView { void AddToPlaylist(const QList& urls); void CopyToLibrary(const QList& urls); void MoveToLibrary(const QList& urls); + void Delete(const QStringList& filenames); protected: void contextMenuEvent(QContextMenuEvent* e); @@ -40,8 +41,10 @@ class FileViewList : public QListView { void AddToPlaylistSlot(); void CopyToLibrarySlot(); void MoveToLibrarySlot(); + void DeleteSlot(); QList UrlListFromSelection() const; + QStringList FilenamesFromSelection() const; private: QMenu* menu_;