Fix a path handling problem that caused the OK button to be greyed out when copying files to a device on Windows. Also show an error message when trying to copy songs that can't be copied (like streams). Fixes issue #750

This commit is contained in:
David Sansome 2010-09-15 20:00:17 +00:00
parent 0adc88a07d
commit 7419c52bec
38 changed files with 134 additions and 16 deletions

View File

@ -270,8 +270,12 @@ void LibraryView::Organise() {
organise_dialog_->SetDestinationModel(library_->directory_model());
organise_dialog_->SetCopy(false);
organise_dialog_->SetSongs(GetSelectedSongs());
organise_dialog_->show();
if (organise_dialog_->SetSongs(GetSelectedSongs()))
organise_dialog_->show();
else {
QMessageBox::warning(this, tr("Error"),
tr("None of the selected songs were suitable for copying to a device"));
}
}
void LibraryView::Delete() {

View File

@ -1187,6 +1187,9 @@ msgstr ""
msgid "None"
msgstr "لا شيء"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr ""

View File

@ -1187,6 +1187,9 @@ msgstr ""
msgid "None"
msgstr ""
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr ""

View File

@ -1210,6 +1210,9 @@ msgstr ""
msgid "None"
msgstr "Cap"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "No connectat"

View File

@ -1189,6 +1189,9 @@ msgstr ""
msgid "None"
msgstr "Žádný"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "Nepřipojeno"

View File

@ -1192,6 +1192,9 @@ msgstr ""
msgid "None"
msgstr "Ingen"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr ""

View File

@ -1212,6 +1212,9 @@ msgstr ""
msgid "None"
msgstr "Nichts"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "Nicht verbunden"

View File

@ -1213,6 +1213,9 @@ msgstr ""
msgid "None"
msgstr "Κανένα"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "Αποσυνδεμένο"

View File

@ -1192,6 +1192,9 @@ msgstr ""
msgid "None"
msgstr "None"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr ""

View File

@ -1189,6 +1189,9 @@ msgstr ""
msgid "None"
msgstr "None"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr ""

View File

@ -1215,6 +1215,9 @@ msgstr ""
msgid "None"
msgstr "Ninguno"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "No conectado"

View File

@ -1187,6 +1187,9 @@ msgstr ""
msgid "None"
msgstr ""
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr ""

View File

@ -1214,6 +1214,9 @@ msgstr ""
msgid "None"
msgstr "Aucun"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "Déconnecté"

View File

@ -1189,6 +1189,9 @@ msgstr ""
msgid "None"
msgstr ""
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr ""

View File

@ -1210,6 +1210,9 @@ msgstr ""
msgid "None"
msgstr "Egyik sem"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "Nincs kapcsolat"

View File

@ -1220,6 +1220,9 @@ msgstr ""
msgid "None"
msgstr "Nessuna"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "Non connesso"

View File

@ -1189,6 +1189,9 @@ msgstr ""
msgid "None"
msgstr ""
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr ""

View File

@ -1187,6 +1187,9 @@ msgstr ""
msgid "None"
msgstr ""
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr ""

View File

@ -1188,6 +1188,9 @@ msgstr ""
msgid "None"
msgstr "Ingen"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr ""

View File

@ -1208,6 +1208,9 @@ msgstr ""
msgid "None"
msgstr "Geen"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "Niet verbonden"

View File

@ -1187,6 +1187,9 @@ msgstr ""
msgid "None"
msgstr "Pas cap"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr ""

View File

@ -1207,6 +1207,9 @@ msgstr ""
msgid "None"
msgstr "Brak"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "Nie podłączono"

View File

@ -1208,6 +1208,9 @@ msgstr ""
msgid "None"
msgstr "Nenhum"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "Não ligado"

View File

@ -1203,6 +1203,9 @@ msgstr ""
msgid "None"
msgstr "Nenhum"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr ""

View File

@ -1188,6 +1188,9 @@ msgstr ""
msgid "None"
msgstr ""
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr ""

View File

@ -1201,6 +1201,9 @@ msgstr ""
msgid "None"
msgstr "Ничего"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "Не подключено"

View File

@ -1206,6 +1206,9 @@ msgstr ""
msgid "None"
msgstr "Nijako"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "Nepripojené"

View File

@ -1206,6 +1206,9 @@ msgstr ""
msgid "None"
msgstr "Brez"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "Ni priključeno"

View File

@ -1192,6 +1192,9 @@ msgstr ""
msgid "None"
msgstr ""
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "Неповезан"

View File

@ -1194,6 +1194,9 @@ msgstr "Inga träffar hittades. Tom sökrutan för att visa hela spellistan igen
msgid "None"
msgstr "Inga"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "Inte ansluten"

View File

@ -1191,6 +1191,9 @@ msgstr ""
msgid "None"
msgstr "Hiçbiri"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "Bağlı Değil"

View File

@ -1177,6 +1177,9 @@ msgstr ""
msgid "None"
msgstr ""
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr ""

View File

@ -1206,6 +1206,9 @@ msgstr ""
msgid "None"
msgstr "Немає"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr "Не з’єднано"

View File

@ -1187,6 +1187,9 @@ msgstr ""
msgid "None"
msgstr "无"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr ""

View File

@ -1190,6 +1190,9 @@ msgstr "沒有找到符合的.清除搜尋框,再次顯示整個播放清單"
msgid "None"
msgstr "沒有"
msgid "None of the selected songs were suitable for copying to a device"
msgstr ""
msgid "Not connected"
msgstr ""

View File

@ -1416,9 +1416,13 @@ void MainWindow::PlaylistCopyToDevice() {
}
organise_dialog_->SetDestinationModel(devices_->connected_devices_model(), true);
organise_dialog_->SetSongs(songs);
organise_dialog_->SetCopy(true);
organise_dialog_->show();
if (organise_dialog_->SetSongs(songs))
organise_dialog_->show();
else {
QMessageBox::warning(this, tr("Error"),
tr("None of the selected songs were suitable for copying to a device"));
}
}
void MainWindow::ShowCoverManager() {

View File

@ -99,21 +99,25 @@ void OrganiseDialog::SetDestinationModel(QAbstractItemModel *model, bool devices
ui_->eject_after->setVisible(devices);
}
void OrganiseDialog::SetSongs(const SongList& songs) {
int OrganiseDialog::SetSongs(const SongList& songs) {
total_size_ = 0;
filenames_.clear();
preview_songs_.clear();
foreach (const Song& song, songs) {
QUrl url(song.filename());
if (url.isEmpty())
continue;
if (!url.scheme().isEmpty() && url.scheme() != "file")
const QString filename = song.filename();
if (filename.isEmpty())
continue;
if (filename.contains("://")) {
QUrl url(song.filename());
if (!url.scheme().isEmpty() && url.scheme() != "file")
continue;
}
if (song.filesize() > 0)
total_size_ += song.filesize();
filenames_ << url.toLocalFile();
filenames_ << filename;
if (preview_songs_.count() < kNumberOfPreviews)
preview_songs_ << song;
@ -121,9 +125,11 @@ void OrganiseDialog::SetSongs(const SongList& songs) {
ui_->free_space->set_additional_bytes(total_size_);
UpdatePreviews();
return filenames_.count();
}
void OrganiseDialog::SetUrls(const QList<QUrl> &urls, quint64 total_size) {
int OrganiseDialog::SetUrls(const QList<QUrl> &urls, quint64 total_size) {
QStringList filenames;
// Only add file:// URLs
@ -133,10 +139,10 @@ void OrganiseDialog::SetUrls(const QList<QUrl> &urls, quint64 total_size) {
filenames << url.toLocalFile();
}
SetFilenames(filenames, total_size);
return SetFilenames(filenames, total_size);
}
void OrganiseDialog::SetFilenames(const QStringList& filenames, quint64 total_size) {
int OrganiseDialog::SetFilenames(const QStringList& filenames, quint64 total_size) {
filenames_ = filenames;
preview_songs_.clear();
@ -150,6 +156,8 @@ void OrganiseDialog::SetFilenames(const QStringList& filenames, quint64 total_si
total_size_ = total_size;
UpdatePreviews();
return filenames_.count();
}
void OrganiseDialog::LoadPreviewSongs(const QString& filename) {

View File

@ -48,9 +48,9 @@ public:
void SetDestinationModel(QAbstractItemModel* model, bool devices = false);
void SetSongs(const SongList& songs);
void SetUrls(const QList<QUrl>& urls, quint64 total_size = 0);
void SetFilenames(const QStringList& filenames, quint64 total_size = 0);
int SetSongs(const SongList& songs);
int SetUrls(const QList<QUrl>& urls, quint64 total_size = 0);
int SetFilenames(const QStringList& filenames, quint64 total_size = 0);
void SetCopy(bool copy);
public slots: