Add error message if editing tag from playlist fails

This commit is contained in:
Chocobozzz 2015-12-20 18:25:45 +01:00
parent 4db358aabb
commit 5675091816
6 changed files with 136 additions and 83 deletions

View File

@ -415,9 +415,15 @@ bool Playlist::setData(const QModelIndex& index, const QVariant& value,
void Playlist::SongSaveComplete(TagReaderReply* reply, void Playlist::SongSaveComplete(TagReaderReply* reply,
const QPersistentModelIndex& index) { const QPersistentModelIndex& index) {
if (reply->is_successful() && index.isValid()) { if (reply->is_successful() && index.isValid()) {
QFuture<void> future = item_at(index.row())->BackgroundReload(); if (reply->message().save_file_response().success()) {
NewClosure(future, this, SLOT(ItemReloadComplete(QPersistentModelIndex)), QFuture<void> future = item_at(index.row())->BackgroundReload();
index); NewClosure(future, this, SLOT(ItemReloadComplete(QPersistentModelIndex)),
index);
} else {
emit Error(tr("An error occurred writing metadata to '%1'").arg(
QString::fromStdString(
reply->request_message().save_file_request().filename())));
}
} }
reply->deleteLater(); reply->deleteLater();
} }
@ -692,7 +698,7 @@ void Playlist::set_current_row(int i, bool is_stopping) {
void Playlist::InsertDynamicItems(int count) { void Playlist::InsertDynamicItems(int count) {
GeneratorInserter* inserter = GeneratorInserter* inserter =
new GeneratorInserter(task_manager_, library_, this); new GeneratorInserter(task_manager_, library_, this);
connect(inserter, SIGNAL(Error(QString)), SIGNAL(LoadTracksError(QString))); connect(inserter, SIGNAL(Error(QString)), SIGNAL(Error(QString)));
connect(inserter, SIGNAL(PlayRequested(QModelIndex)), connect(inserter, SIGNAL(PlayRequested(QModelIndex)),
SIGNAL(PlayRequested(QModelIndex))); SIGNAL(PlayRequested(QModelIndex)));
@ -820,7 +826,7 @@ bool Playlist::dropMimeData(const QMimeData* data, Qt::DropAction action,
} else if (data->hasFormat(kCddaMimeType)) { } else if (data->hasFormat(kCddaMimeType)) {
SongLoaderInserter* inserter = new SongLoaderInserter( SongLoaderInserter* inserter = new SongLoaderInserter(
task_manager_, library_, backend_->app()->player()); task_manager_, library_, backend_->app()->player());
connect(inserter, SIGNAL(Error(QString)), SIGNAL(LoadTracksError(QString))); connect(inserter, SIGNAL(Error(QString)), SIGNAL(Error(QString)));
inserter->LoadAudioCD(this, row, play_now, enqueue_now); inserter->LoadAudioCD(this, row, play_now, enqueue_now);
} else if (data->hasUrls()) { } else if (data->hasUrls()) {
// URL list dragged from the file list or some other app // URL list dragged from the file list or some other app
@ -834,7 +840,7 @@ void Playlist::InsertUrls(const QList<QUrl>& urls, int pos, bool play_now,
bool enqueue) { bool enqueue) {
SongLoaderInserter* inserter = new SongLoaderInserter( SongLoaderInserter* inserter = new SongLoaderInserter(
task_manager_, library_, backend_->app()->player()); task_manager_, library_, backend_->app()->player());
connect(inserter, SIGNAL(Error(QString)), SIGNAL(LoadTracksError(QString))); connect(inserter, SIGNAL(Error(QString)), SIGNAL(Error(QString)));
inserter->Load(this, pos, play_now, enqueue, urls); inserter->Load(this, pos, play_now, enqueue, urls);
} }
@ -848,7 +854,7 @@ void Playlist::InsertSmartPlaylist(GeneratorPtr generator, int pos,
GeneratorInserter* inserter = GeneratorInserter* inserter =
new GeneratorInserter(task_manager_, library_, this); new GeneratorInserter(task_manager_, library_, this);
connect(inserter, SIGNAL(Error(QString)), SIGNAL(LoadTracksError(QString))); connect(inserter, SIGNAL(Error(QString)), SIGNAL(Error(QString)));
inserter->Load(this, pos, play_now, enqueue, generator); inserter->Load(this, pos, play_now, enqueue, generator);

View File

@ -348,7 +348,7 @@ signals:
void PlaylistChanged(); void PlaylistChanged();
void DynamicModeChanged(bool dynamic); void DynamicModeChanged(bool dynamic);
void LoadTracksError(const QString& message); void Error(const QString& message);
// Signals that the queue has changed, meaning that the remaining queued // Signals that the queue has changed, meaning that the remaining queued
// items should update their position. // items should update their position.

View File

@ -117,7 +117,7 @@ Playlist* PlaylistManager::AddPlaylist(int id, const QString& name,
connect(ret, SIGNAL(PlaylistChanged()), SLOT(UpdateSummaryText())); connect(ret, SIGNAL(PlaylistChanged()), SLOT(UpdateSummaryText()));
connect(ret, SIGNAL(EditingFinished(QModelIndex)), connect(ret, SIGNAL(EditingFinished(QModelIndex)),
SIGNAL(EditingFinished(QModelIndex))); SIGNAL(EditingFinished(QModelIndex)));
connect(ret, SIGNAL(LoadTracksError(QString)), SIGNAL(Error(QString))); connect(ret, SIGNAL(Error(QString)), SIGNAL(Error(QString)));
connect(ret, SIGNAL(PlayRequested(QModelIndex)), connect(ret, SIGNAL(PlayRequested(QModelIndex)),
SIGNAL(PlayRequested(QModelIndex))); SIGNAL(PlayRequested(QModelIndex)));
connect(playlist_container_->view(), connect(playlist_container_->view(),

View File

@ -230,23 +230,31 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd,
SLOT(AddToPlaylist(QMimeData*))); SLOT(AddToPlaylist(QMimeData*)));
// Add tabs to the fancy tab widget // Add tabs to the fancy tab widget
ui_->tabs->AddTab(global_search_view_, IconLoader::Load("search", IconLoader::Base), ui_->tabs->AddTab(global_search_view_,
IconLoader::Load("search", IconLoader::Base),
tr("Search", "Global search settings dialog title.")); tr("Search", "Global search settings dialog title."));
ui_->tabs->AddTab(library_view_, IconLoader::Load("folder-sound", IconLoader::Base), ui_->tabs->AddTab(library_view_,
IconLoader::Load("folder-sound", IconLoader::Base),
tr("Library")); tr("Library"));
ui_->tabs->AddTab(file_view_, IconLoader::Load("document-open", IconLoader::Base), ui_->tabs->AddTab(file_view_,
IconLoader::Load("document-open", IconLoader::Base),
tr("Files")); tr("Files"));
ui_->tabs->AddTab(playlist_list_, IconLoader::Load("view-media-playlist", IconLoader::Base), ui_->tabs->AddTab(playlist_list_,
IconLoader::Load("view-media-playlist", IconLoader::Base),
tr("Playlists")); tr("Playlists"));
ui_->tabs->AddTab(internet_view_, IconLoader::Load("applications-internet", IconLoader::Base), ui_->tabs->AddTab(internet_view_,
IconLoader::Load("applications-internet", IconLoader::Base),
tr("Internet")); tr("Internet"));
ui_->tabs->AddTab(device_view_container_, ui_->tabs->AddTab(
IconLoader::Load("multimedia-player-ipod-mini-blue", IconLoader::Base), device_view_container_,
tr("Devices")); IconLoader::Load("multimedia-player-ipod-mini-blue", IconLoader::Base),
tr("Devices"));
ui_->tabs->AddSpacer(); ui_->tabs->AddSpacer();
ui_->tabs->AddTab(song_info_view_, IconLoader::Load("view-media-lyrics", IconLoader::Base), ui_->tabs->AddTab(song_info_view_,
IconLoader::Load("view-media-lyrics", IconLoader::Base),
tr("Song info")); tr("Song info"));
ui_->tabs->AddTab(artist_info_view_, IconLoader::Load("x-clementine-artist", IconLoader::Base), ui_->tabs->AddTab(artist_info_view_,
IconLoader::Load("x-clementine-artist", IconLoader::Base),
tr("Artist info")); tr("Artist info"));
// Add the now playing widget to the fancy tab widget // Add the now playing widget to the fancy tab widget
@ -293,39 +301,68 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd,
qLog(Debug) << "Creating UI"; qLog(Debug) << "Creating UI";
ui_->action_about->setIcon(IconLoader::Load("help-about", IconLoader::Base)); ui_->action_about->setIcon(IconLoader::Load("help-about", IconLoader::Base));
ui_->action_about_qt->setIcon(IconLoader::Load("qtlogo", IconLoader::Base)); ui_->action_about_qt->setIcon(IconLoader::Load("qtlogo", IconLoader::Base));
ui_->action_add_file->setIcon(IconLoader::Load("document-open", IconLoader::Base)); ui_->action_add_file->setIcon(
ui_->action_add_folder->setIcon(IconLoader::Load("document-open-folder", IconLoader::Base)); IconLoader::Load("document-open", IconLoader::Base));
ui_->action_add_stream->setIcon(IconLoader::Load("document-open-remote", IconLoader::Base)); ui_->action_add_folder->setIcon(
ui_->action_add_podcast->setIcon(IconLoader::Load("podcast", IconLoader::Provider)); IconLoader::Load("document-open-folder", IconLoader::Base));
ui_->action_clear_playlist->setIcon(IconLoader::Load("edit-clear-list", IconLoader::Base)); ui_->action_add_stream->setIcon(
ui_->action_configure->setIcon(IconLoader::Load("configure", IconLoader::Base)); IconLoader::Load("document-open-remote", IconLoader::Base));
ui_->action_cover_manager->setIcon(IconLoader::Load("download", IconLoader::Base)); ui_->action_add_podcast->setIcon(
ui_->action_edit_track->setIcon(IconLoader::Load("edit-rename", IconLoader::Base)); IconLoader::Load("podcast", IconLoader::Provider));
ui_->action_equalizer->setIcon(IconLoader::Load("view-media-equalizer", IconLoader::Base)); ui_->action_clear_playlist->setIcon(
IconLoader::Load("edit-clear-list", IconLoader::Base));
ui_->action_configure->setIcon(
IconLoader::Load("configure", IconLoader::Base));
ui_->action_cover_manager->setIcon(
IconLoader::Load("download", IconLoader::Base));
ui_->action_edit_track->setIcon(
IconLoader::Load("edit-rename", IconLoader::Base));
ui_->action_equalizer->setIcon(
IconLoader::Load("view-media-equalizer", IconLoader::Base));
ui_->action_jump->setIcon(IconLoader::Load("go-jump", IconLoader::Base)); ui_->action_jump->setIcon(IconLoader::Load("go-jump", IconLoader::Base));
ui_->action_next_track->setIcon(IconLoader::Load("media-skip-forward", IconLoader::Base)); ui_->action_next_track->setIcon(
ui_->action_open_media->setIcon(IconLoader::Load("document-open", IconLoader::Base)); IconLoader::Load("media-skip-forward", IconLoader::Base));
ui_->action_open_cd->setIcon(IconLoader::Load("media-optical", IconLoader::Base)); ui_->action_open_media->setIcon(
ui_->action_play_pause->setIcon(IconLoader::Load("media-playback-start", IconLoader::Base)); IconLoader::Load("document-open", IconLoader::Base));
ui_->action_previous_track->setIcon(IconLoader::Load("media-skip-backward", IconLoader::Base)); ui_->action_open_cd->setIcon(
ui_->action_mute->setIcon(IconLoader::Load("audio-volume-muted", IconLoader::Base)); IconLoader::Load("media-optical", IconLoader::Base));
ui_->action_quit->setIcon(IconLoader::Load("application-exit", IconLoader::Base)); ui_->action_play_pause->setIcon(
ui_->action_remove_from_playlist->setIcon(IconLoader::Load("list-remove", IconLoader::Base)); IconLoader::Load("media-playback-start", IconLoader::Base));
ui_->action_repeat_mode->setIcon(IconLoader::Load("media-playlist-repeat", IconLoader::Base)); ui_->action_previous_track->setIcon(
ui_->action_rip_audio_cd->setIcon(IconLoader::Load("media-optical", IconLoader::Base)); IconLoader::Load("media-skip-backward", IconLoader::Base));
ui_->action_shuffle->setIcon(IconLoader::Load("x-clementine-shuffle", IconLoader::Base)); ui_->action_mute->setIcon(
ui_->action_shuffle_mode->setIcon(IconLoader::Load("media-playlist-shuffle", IconLoader::Base)); IconLoader::Load("audio-volume-muted", IconLoader::Base));
ui_->action_stop->setIcon(IconLoader::Load("media-playback-stop", IconLoader::Base)); ui_->action_quit->setIcon(
IconLoader::Load("application-exit", IconLoader::Base));
ui_->action_remove_from_playlist->setIcon(
IconLoader::Load("list-remove", IconLoader::Base));
ui_->action_repeat_mode->setIcon(
IconLoader::Load("media-playlist-repeat", IconLoader::Base));
ui_->action_rip_audio_cd->setIcon(
IconLoader::Load("media-optical", IconLoader::Base));
ui_->action_shuffle->setIcon(
IconLoader::Load("x-clementine-shuffle", IconLoader::Base));
ui_->action_shuffle_mode->setIcon(
IconLoader::Load("media-playlist-shuffle", IconLoader::Base));
ui_->action_stop->setIcon(
IconLoader::Load("media-playback-stop", IconLoader::Base));
ui_->action_stop_after_this_track->setIcon( ui_->action_stop_after_this_track->setIcon(
IconLoader::Load("media-playback-stop", IconLoader::Base)); IconLoader::Load("media-playback-stop", IconLoader::Base));
ui_->action_new_playlist->setIcon(IconLoader::Load("document-new", IconLoader::Base)); ui_->action_new_playlist->setIcon(
ui_->action_load_playlist->setIcon(IconLoader::Load("document-open", IconLoader::Base)); IconLoader::Load("document-new", IconLoader::Base));
ui_->action_save_playlist->setIcon(IconLoader::Load("document-save", IconLoader::Base)); ui_->action_load_playlist->setIcon(
ui_->action_full_library_scan->setIcon(IconLoader::Load("view-refresh", IconLoader::Base)); IconLoader::Load("document-open", IconLoader::Base));
ui_->action_rain->setIcon(IconLoader::Load("weather-showers-scattered", IconLoader::Base)); ui_->action_save_playlist->setIcon(
ui_->action_hypnotoad->setIcon(IconLoader::Load("hypnotoad", IconLoader::Base)); IconLoader::Load("document-save", IconLoader::Base));
ui_->action_full_library_scan->setIcon(
IconLoader::Load("view-refresh", IconLoader::Base));
ui_->action_rain->setIcon(
IconLoader::Load("weather-showers-scattered", IconLoader::Base));
ui_->action_hypnotoad->setIcon(
IconLoader::Load("hypnotoad", IconLoader::Base));
ui_->action_kittens->setIcon(IconLoader::Load("kittens", IconLoader::Base)); ui_->action_kittens->setIcon(IconLoader::Load("kittens", IconLoader::Base));
ui_->action_enterprise->setIcon(IconLoader::Load("enterprise", IconLoader::Base)); ui_->action_enterprise->setIcon(
IconLoader::Load("enterprise", IconLoader::Base));
ui_->action_love->setIcon(IconLoader::Load("love", IconLoader::Lastfm)); ui_->action_love->setIcon(IconLoader::Load("love", IconLoader::Lastfm));
// File view connections // File view connections
@ -589,9 +626,9 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd,
connect(library_view_group, SIGNAL(triggered(QAction*)), connect(library_view_group, SIGNAL(triggered(QAction*)),
SLOT(ChangeLibraryQueryMode(QAction*))); SLOT(ChangeLibraryQueryMode(QAction*)));
QAction* library_config_action = new QAction( QAction* library_config_action =
IconLoader::Load("configure", IconLoader::Base), new QAction(IconLoader::Load("configure", IconLoader::Base),
tr("Configure library..."), this); tr("Configure library..."), this);
connect(library_config_action, SIGNAL(triggered()), connect(library_config_action, SIGNAL(triggered()),
SLOT(ShowLibraryConfig())); SLOT(ShowLibraryConfig()));
library_view_->filter()->SetSettingsGroup(kSettingsGroup); library_view_->filter()->SetSettingsGroup(kSettingsGroup);
@ -611,7 +648,7 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd,
playlist_menu_->addAction(tr("Play"), this, SLOT(PlaylistPlay())); playlist_menu_->addAction(tr("Play"), this, SLOT(PlaylistPlay()));
playlist_menu_->addAction(ui_->action_stop); playlist_menu_->addAction(ui_->action_stop);
playlist_stop_after_ = playlist_menu_->addAction( playlist_stop_after_ = playlist_menu_->addAction(
IconLoader::Load("media-playback-stop", IconLoader::Base), IconLoader::Load("media-playback-stop", IconLoader::Base),
tr("Stop after this track"), this, SLOT(PlaylistStopAfter())); tr("Stop after this track"), this, SLOT(PlaylistStopAfter()));
playlist_queue_ = playlist_menu_->addAction("", this, SLOT(PlaylistQueue())); playlist_queue_ = playlist_menu_->addAction("", this, SLOT(PlaylistQueue()));
playlist_queue_->setShortcut(QKeySequence("Ctrl+D")); playlist_queue_->setShortcut(QKeySequence("Ctrl+D"));
@ -630,29 +667,26 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd,
playlist_menu_->addAction(ui_->action_add_files_to_transcoder); playlist_menu_->addAction(ui_->action_add_files_to_transcoder);
playlist_menu_->addSeparator(); playlist_menu_->addSeparator();
playlist_copy_to_library_ = playlist_menu_->addAction( playlist_copy_to_library_ = playlist_menu_->addAction(
IconLoader::Load("edit-copy", IconLoader::Base), IconLoader::Load("edit-copy", IconLoader::Base), tr("Copy to library..."),
tr("Copy to library..."), this, SLOT(PlaylistCopyToLibrary())); this, SLOT(PlaylistCopyToLibrary()));
playlist_move_to_library_ = playlist_menu_->addAction( playlist_move_to_library_ = playlist_menu_->addAction(
IconLoader::Load("go-jump", IconLoader::Base), IconLoader::Load("go-jump", IconLoader::Base), tr("Move to library..."),
tr("Move to library..."), this, SLOT(PlaylistMoveToLibrary())); this, SLOT(PlaylistMoveToLibrary()));
playlist_organise_ = playlist_menu_->addAction(IconLoader::Load("edit-copy", playlist_organise_ = playlist_menu_->addAction(
IconLoader::Base), IconLoader::Load("edit-copy", IconLoader::Base), tr("Organise files..."),
tr("Organise files..."), this, this, SLOT(PlaylistMoveToLibrary()));
SLOT(PlaylistMoveToLibrary()));
playlist_copy_to_device_ = playlist_menu_->addAction( playlist_copy_to_device_ = playlist_menu_->addAction(
IconLoader::Load("multimedia-player-ipod-mini-blue", IconLoader::Base), IconLoader::Load("multimedia-player-ipod-mini-blue", IconLoader::Base),
tr("Copy to device..."), this, SLOT(PlaylistCopyToDevice())); tr("Copy to device..."), this, SLOT(PlaylistCopyToDevice()));
playlist_delete_ = playlist_menu_->addAction(IconLoader::Load("edit-delete", playlist_delete_ = playlist_menu_->addAction(
IconLoader::Base), IconLoader::Load("edit-delete", IconLoader::Base),
tr("Delete from disk..."), this, tr("Delete from disk..."), this, SLOT(PlaylistDelete()));
SLOT(PlaylistDelete()));
playlist_open_in_browser_ = playlist_menu_->addAction( playlist_open_in_browser_ = playlist_menu_->addAction(
IconLoader::Load("document-open-folder", IconLoader::Base), IconLoader::Load("document-open-folder", IconLoader::Base),
tr("Show in file browser..."), tr("Show in file browser..."), this, SLOT(PlaylistOpenInBrowser()));
this, SLOT(PlaylistOpenInBrowser()));
playlist_show_in_library_ = playlist_menu_->addAction( playlist_show_in_library_ = playlist_menu_->addAction(
IconLoader::Load("edit-find", IconLoader::Base), IconLoader::Load("edit-find", IconLoader::Base), tr("Show in library..."),
tr("Show in library..."), this, SLOT(ShowInLibrary())); this, SLOT(ShowInLibrary()));
playlist_menu_->addSeparator(); playlist_menu_->addSeparator();
playlistitem_actions_separator_ = playlist_menu_->addSeparator(); playlistitem_actions_separator_ = playlist_menu_->addSeparator();
playlist_menu_->addAction(ui_->action_clear_playlist); playlist_menu_->addAction(ui_->action_clear_playlist);
@ -1034,7 +1068,8 @@ void MainWindow::MediaStopped() {
ui_->action_stop->setEnabled(false); ui_->action_stop->setEnabled(false);
ui_->action_stop_after_this_track->setEnabled(false); ui_->action_stop_after_this_track->setEnabled(false);
ui_->action_play_pause->setIcon(IconLoader::Load("media-playback-start", IconLoader::Base)); ui_->action_play_pause->setIcon(
IconLoader::Load("media-playback-start", IconLoader::Base));
ui_->action_play_pause->setText(tr("Play")); ui_->action_play_pause->setText(tr("Play"));
ui_->action_play_pause->setEnabled(true); ui_->action_play_pause->setEnabled(true);
@ -1052,7 +1087,8 @@ void MainWindow::MediaStopped() {
void MainWindow::MediaPaused() { void MainWindow::MediaPaused() {
ui_->action_stop->setEnabled(true); ui_->action_stop->setEnabled(true);
ui_->action_stop_after_this_track->setEnabled(true); ui_->action_stop_after_this_track->setEnabled(true);
ui_->action_play_pause->setIcon(IconLoader::Load("media-playback-start", IconLoader::Base)); ui_->action_play_pause->setIcon(
IconLoader::Load("media-playback-start", IconLoader::Base));
ui_->action_play_pause->setText(tr("Play")); ui_->action_play_pause->setText(tr("Play"));
ui_->action_play_pause->setEnabled(true); ui_->action_play_pause->setEnabled(true);
@ -1066,7 +1102,8 @@ void MainWindow::MediaPaused() {
void MainWindow::MediaPlaying() { void MainWindow::MediaPlaying() {
ui_->action_stop->setEnabled(true); ui_->action_stop->setEnabled(true);
ui_->action_stop_after_this_track->setEnabled(true); ui_->action_stop_after_this_track->setEnabled(true);
ui_->action_play_pause->setIcon(IconLoader::Load("media-playback-pause", IconLoader::Base)); ui_->action_play_pause->setIcon(
IconLoader::Load("media-playback-pause", IconLoader::Base));
ui_->action_play_pause->setText(tr("Pause")); ui_->action_play_pause->setText(tr("Pause"));
bool enable_play_pause = !(app_->player()->GetCurrentItem()->options() & bool enable_play_pause = !(app_->player()->GetCurrentItem()->options() &
@ -1166,7 +1203,8 @@ void MainWindow::ScrobbleButtonVisibilityChanged(bool value) {
// check if the song was scrobbled // check if the song was scrobbled
if (app_->playlist_manager()->active()->get_lastfm_status() == if (app_->playlist_manager()->active()->get_lastfm_status() ==
Playlist::LastFM_Scrobbled) { Playlist::LastFM_Scrobbled) {
ui_->action_toggle_scrobbling->setIcon(IconLoader::Load("as", IconLoader::Lastfm)); ui_->action_toggle_scrobbling->setIcon(
IconLoader::Load("as", IconLoader::Lastfm));
} else { } else {
#ifdef HAVE_LIBLASTFM #ifdef HAVE_LIBLASTFM
SetToggleScrobblingIcon(app_->scrobbler()->IsScrobblingEnabled()); SetToggleScrobblingIcon(app_->scrobbler()->IsScrobblingEnabled());
@ -1563,10 +1601,12 @@ void MainWindow::PlaylistRightClick(const QPoint& global_pos,
source_index.row() && source_index.row() &&
app_->player()->GetState() == Engine::Playing) { app_->player()->GetState() == Engine::Playing) {
playlist_play_pause_->setText(tr("Pause")); playlist_play_pause_->setText(tr("Pause"));
playlist_play_pause_->setIcon(IconLoader::Load("media-playback-pause", IconLoader::Base)); playlist_play_pause_->setIcon(
IconLoader::Load("media-playback-pause", IconLoader::Base));
} else { } else {
playlist_play_pause_->setText(tr("Play")); playlist_play_pause_->setText(tr("Play"));
playlist_play_pause_->setIcon(IconLoader::Load("media-playback-start", IconLoader::Base)); playlist_play_pause_->setIcon(
IconLoader::Load("media-playback-start", IconLoader::Base));
} }
// Are we allowed to pause? // Are we allowed to pause?
@ -2619,6 +2659,8 @@ void MainWindow::AutoCompleteTags() {
SLOT(AutoCompleteTagsAccepted())); SLOT(AutoCompleteTagsAccepted()));
connect(track_selection_dialog_.get(), SIGNAL(finished(int)), connect(track_selection_dialog_.get(), SIGNAL(finished(int)),
tag_fetcher_.get(), SLOT(Cancel())); tag_fetcher_.get(), SLOT(Cancel()));
connect(track_selection_dialog_.get(), SIGNAL(Error(QString)),
SLOT(ShowErrorDialog(QString)));
} }
// Get the selected songs and start fetching tags for them // Get the selected songs and start fetching tags for them
@ -2654,7 +2696,8 @@ void MainWindow::AutoCompleteTagsAccepted() {
} }
QPixmap MainWindow::CreateOverlayedIcon(int position, int scrobble_point) { QPixmap MainWindow::CreateOverlayedIcon(int position, int scrobble_point) {
QPixmap normal_icon = IconLoader::Load("as_light", IconLoader::Lastfm).pixmap(16); QPixmap normal_icon =
IconLoader::Load("as_light", IconLoader::Lastfm).pixmap(16);
QPixmap light_icon = IconLoader::Load("as", IconLoader::Lastfm).pixmap(16); QPixmap light_icon = IconLoader::Load("as", IconLoader::Lastfm).pixmap(16);
QRect rect(normal_icon.rect()); QRect rect(normal_icon.rect());
@ -2682,9 +2725,11 @@ QPixmap MainWindow::CreateOverlayedIcon(int position, int scrobble_point) {
void MainWindow::SetToggleScrobblingIcon(bool value) { void MainWindow::SetToggleScrobblingIcon(bool value) {
if (!value) { if (!value) {
ui_->action_toggle_scrobbling->setIcon(IconLoader::Load("as_disabled", IconLoader::Lastfm)); ui_->action_toggle_scrobbling->setIcon(
IconLoader::Load("as_disabled", IconLoader::Lastfm));
} else { } else {
ui_->action_toggle_scrobbling->setIcon(IconLoader::Load("as_light", IconLoader::Lastfm)); ui_->action_toggle_scrobbling->setIcon(
IconLoader::Load("as_light", IconLoader::Lastfm));
} }
} }
@ -2699,7 +2744,8 @@ void MainWindow::ScrobbleSubmitted() {
// update the button icon // update the button icon
if (last_fm_enabled) if (last_fm_enabled)
ui_->action_toggle_scrobbling->setIcon(IconLoader::Load("as", IconLoader::Lastfm)); ui_->action_toggle_scrobbling->setIcon(
IconLoader::Load("as", IconLoader::Lastfm));
} }
void MainWindow::ScrobbleError(int value) { void MainWindow::ScrobbleError(int value) {

View File

@ -244,8 +244,8 @@ void TrackSelectionDialog::SaveData(const QList<Data>& data) {
if (!TagReaderClient::Instance()->SaveFileBlocking(copy.url().toLocalFile(), if (!TagReaderClient::Instance()->SaveFileBlocking(copy.url().toLocalFile(),
copy)) { copy)) {
qLog(Warning) << "Failed to write new auto-tags to" emit Error(tr("Failed to write new auto-tags to '%1'")
<< copy.url().toLocalFile(); .arg(copy.url().toLocalFile()));
} }
} }
} }
@ -256,7 +256,7 @@ void TrackSelectionDialog::accept() {
// Save tags in the background // Save tags in the background
QFuture<void> future = QFuture<void> future =
QtConcurrent::run(&TrackSelectionDialog::SaveData, data_); QtConcurrent::run(this, &TrackSelectionDialog::SaveData, data_);
NewClosure(future, this, SLOT(AcceptFinished())); NewClosure(future, this, SLOT(AcceptFinished()));
return; return;
} }

View File

@ -47,6 +47,7 @@ class TrackSelectionDialog : public QDialog {
void accept(); void accept();
signals: signals:
void Error(const QString& error);
void SongChosen(const Song& original_song, const Song& new_metadata); void SongChosen(const Song& original_song, const Song& new_metadata);
private slots: private slots:
@ -75,7 +76,7 @@ signals:
void AddSong(const Song& song, int result_index, QTreeWidget* parent) const; void AddSong(const Song& song, int result_index, QTreeWidget* parent) const;
void SetLoading(const QString& message); void SetLoading(const QString& message);
static void SaveData(const QList<Data>& data); void SaveData(const QList<Data>& data);
private: private:
QList<Data> data_; QList<Data> data_;