Add some progress information to the album cover fetcher
This commit is contained in:
parent
7e1b54a779
commit
b16d072cd6
|
@ -592,12 +592,25 @@ msgstr ""
|
|||
msgid "Albums without covers"
|
||||
msgstr ""
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr ""
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr ""
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -593,12 +593,25 @@ msgstr "Alba s obaly"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Alba bez obalů"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "Všichni umělci"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Různí umělci"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr "Vybrat obal ručně"
|
||||
|
||||
|
|
|
@ -595,12 +595,25 @@ msgstr "Albummer med omslag"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Albummer uden omslag"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "Alle kunstnere"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Diverse kunstnere"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr "Vælg omslag manuelt"
|
||||
|
||||
|
|
|
@ -595,12 +595,25 @@ msgstr "Alben mit Cover"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Alben ohne Cover"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "Alle Künstler"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Verschiedene Interpreten"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr "Cover selbst auswählen"
|
||||
|
||||
|
|
|
@ -598,12 +598,25 @@ msgstr "Άλμπουμ με εξώφυλλα"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Άλμπουμ χωρίς εξώφυλλα"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "Όλοι οι καλλιτέχνες"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Διάφοροι καλλιτέχνες"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr "Επιλογή εξώφυλλου χειροκίνητα"
|
||||
|
||||
|
|
|
@ -595,12 +595,25 @@ msgstr "Albums with covers"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Albums without covers"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "All artists"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Various artists"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr "Choose manual cover"
|
||||
|
||||
|
|
|
@ -592,12 +592,25 @@ msgstr "Albums with covers"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Albums without covers"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "All artists"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Various artists"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr "Choose manual cover"
|
||||
|
||||
|
|
|
@ -597,12 +597,25 @@ msgstr "Álbumes con carátula"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Álbumes sin carátula"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "Todos los artistas"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Varios Artistas"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr "Establecer carátula personalizada"
|
||||
|
||||
|
|
|
@ -592,12 +592,25 @@ msgstr ""
|
|||
msgid "Albums without covers"
|
||||
msgstr ""
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr ""
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr ""
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -595,12 +595,25 @@ msgstr "Albums ayant une jaquette"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Albums sans jaquette"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "Tous les artistes"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Compilations d'artistes"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr "Choisir une jaquette manuellement"
|
||||
|
||||
|
|
|
@ -593,12 +593,25 @@ msgstr "Álbuns con capas"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Álbuns sen capas"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "Todos os artistas"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Vários artistas"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr "Escoller unha capa manualmente"
|
||||
|
||||
|
|
|
@ -597,12 +597,25 @@ msgstr "Album con copertina"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Album senza copertine"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "Tutti gli artisti"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Artisti vari"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr "Scelta manuale della copertina"
|
||||
|
||||
|
|
|
@ -592,12 +592,25 @@ msgstr ""
|
|||
msgid "Albums without covers"
|
||||
msgstr ""
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr ""
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr ""
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -592,12 +592,25 @@ msgstr "Album med cover"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Album uten cover"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "Alle artister"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Diverse artister"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr "Velg cover manuelt"
|
||||
|
||||
|
|
|
@ -592,12 +592,25 @@ msgstr ""
|
|||
msgid "Albums without covers"
|
||||
msgstr ""
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr ""
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr ""
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -593,12 +593,25 @@ msgstr "Albumy z okładkami"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Albumy bez okładek"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "Wszyscy wykonawcy"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Różni wykonawcy"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr "Wybierz okładkę ręcznie"
|
||||
|
||||
|
|
|
@ -596,12 +596,25 @@ msgstr "Álbuns com capas"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Álbuns sem capas"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "Todos os artistas"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Vários artistas"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr "Escolher uma capa manualmente"
|
||||
|
||||
|
|
|
@ -598,12 +598,25 @@ msgstr "Álbuns com capas"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Álbuns sem capas"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "Todos os artistas"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Vários artistas"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr "Escolher capa manualmente"
|
||||
|
||||
|
|
|
@ -592,12 +592,25 @@ msgstr "Albumele cu coperți"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Albume fără coperți"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "Toți artiștii"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Artiști diferiți"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -595,12 +595,25 @@ msgstr "Альбомы с обложками"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Альбомы без обложек"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "Все исполнители"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Разные исполнители"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr "Укажите обложку вручную"
|
||||
|
||||
|
|
|
@ -596,12 +596,25 @@ msgstr "Albumy s obalmi"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Albumy bez obalov"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "Všetci interpréti"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Rôzni interpréti"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr "Vybrať obal ručne"
|
||||
|
||||
|
|
|
@ -594,12 +594,25 @@ msgstr "Album med omslag"
|
|||
msgid "Albums without covers"
|
||||
msgstr "Album utan omslag"
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr "Alla artister"
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr "Diverse artister"
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr "Ange omslag manuellt"
|
||||
|
||||
|
|
|
@ -592,12 +592,25 @@ msgstr ""
|
|||
msgid "Albums without covers"
|
||||
msgstr ""
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr ""
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr ""
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -592,12 +592,25 @@ msgstr ""
|
|||
msgid "Albums without covers"
|
||||
msgstr ""
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr ""
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr ""
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -592,12 +592,25 @@ msgstr ""
|
|||
msgid "Albums without covers"
|
||||
msgstr ""
|
||||
|
||||
msgid "Really cancel?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Closing this window will stop searching for album covers."
|
||||
msgstr ""
|
||||
|
||||
msgid "Don't stop!"
|
||||
msgstr ""
|
||||
|
||||
msgid "All artists"
|
||||
msgstr ""
|
||||
|
||||
msgid "Various artists"
|
||||
msgstr ""
|
||||
|
||||
#, qt-format
|
||||
msgid "Got %1 covers out of %2 (%3 failed)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose manual cover"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <QLabel>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QProgressBar>
|
||||
#include <QTimer>
|
||||
|
||||
const char* AlbumCoverManager::kSettingsGroup = "CoverManager";
|
||||
|
||||
|
@ -48,7 +50,12 @@ AlbumCoverManager::AlbumCoverManager(NetworkAccessManager* network,
|
|||
cover_fetcher_(new AlbumCoverFetcher(network, this)),
|
||||
artist_icon_(IconLoader::Load("x-clementine-artist")),
|
||||
all_artists_icon_(IconLoader::Load("x-clementine-album")),
|
||||
context_menu_(new QMenu(this)) {
|
||||
context_menu_(new QMenu(this)),
|
||||
progress_bar_(new QProgressBar(this)),
|
||||
jobs_(0),
|
||||
got_covers_(0),
|
||||
missing_covers_(0)
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
|
||||
// Icons
|
||||
|
@ -69,6 +76,10 @@ AlbumCoverManager::AlbumCoverManager(NetworkAccessManager* network,
|
|||
p.drawImage((120 - nocover.width()) / 2, (120 - nocover.height()) / 2, nocover);
|
||||
p.end();
|
||||
no_cover_icon_ = QPixmap::fromImage(square_nocover);
|
||||
|
||||
// Set up the status bar
|
||||
statusBar()->addPermanentWidget(progress_bar_);
|
||||
progress_bar_->hide();
|
||||
}
|
||||
|
||||
AlbumCoverManager::~AlbumCoverManager() {
|
||||
|
@ -142,7 +153,20 @@ void AlbumCoverManager::showEvent(QShowEvent *) {
|
|||
Reset();
|
||||
}
|
||||
|
||||
void AlbumCoverManager::closeEvent(QCloseEvent *) {
|
||||
void AlbumCoverManager::closeEvent(QCloseEvent* e) {
|
||||
if (!cover_fetching_tasks_.isEmpty()) {
|
||||
boost::scoped_ptr<QMessageBox> message_box(new QMessageBox(
|
||||
QMessageBox::Question, tr("Really cancel?"),
|
||||
tr("Closing this window will stop searching for album covers."),
|
||||
QMessageBox::Abort, this));
|
||||
message_box->addButton(tr("Don't stop!"), QMessageBox::AcceptRole);
|
||||
|
||||
if (message_box->exec() != QMessageBox::Abort) {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Save geometry
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
|
@ -163,6 +187,8 @@ void AlbumCoverManager::CancelRequests() {
|
|||
cover_fetching_tasks_.clear();
|
||||
cover_fetcher_->Clear();
|
||||
ui_->fetch->setEnabled(true);
|
||||
progress_bar_->hide();
|
||||
statusBar()->clearMessage();
|
||||
}
|
||||
|
||||
void AlbumCoverManager::Reset() {
|
||||
|
@ -291,10 +317,15 @@ void AlbumCoverManager::FetchAlbumCovers() {
|
|||
quint64 id = cover_fetcher_->FetchAlbumCover(
|
||||
item->data(Role_ArtistName).toString(), item->data(Role_AlbumName).toString());
|
||||
cover_fetching_tasks_[id] = item;
|
||||
jobs_ ++;
|
||||
}
|
||||
|
||||
if (!cover_fetching_tasks_.isEmpty())
|
||||
ui_->fetch->setEnabled(false);
|
||||
|
||||
progress_bar_->setMaximum(jobs_);
|
||||
progress_bar_->show();
|
||||
UpdateStatusText();
|
||||
}
|
||||
|
||||
void AlbumCoverManager::AlbumCoverFetched(quint64 id, const QImage &image) {
|
||||
|
@ -302,7 +333,11 @@ void AlbumCoverManager::AlbumCoverFetched(quint64 id, const QImage &image) {
|
|||
return;
|
||||
|
||||
QListWidgetItem* item = cover_fetching_tasks_.take(id);
|
||||
if (!image.isNull()) {
|
||||
if (image.isNull()) {
|
||||
missing_covers_ ++;
|
||||
} else {
|
||||
got_covers_ ++;
|
||||
|
||||
const QString artist = item->data(Role_ArtistName).toString();
|
||||
const QString album = item->data(Role_AlbumName).toString();
|
||||
|
||||
|
@ -332,6 +367,24 @@ void AlbumCoverManager::AlbumCoverFetched(quint64 id, const QImage &image) {
|
|||
|
||||
if (cover_fetching_tasks_.isEmpty())
|
||||
ui_->fetch->setEnabled(true);
|
||||
|
||||
UpdateStatusText();
|
||||
}
|
||||
|
||||
void AlbumCoverManager::UpdateStatusText() {
|
||||
QString message = tr("Got %1 covers out of %2 (%3 failed)")
|
||||
.arg(got_covers_).arg(jobs_).arg(missing_covers_);
|
||||
statusBar()->showMessage(message);
|
||||
progress_bar_->setValue(got_covers_ + missing_covers_);
|
||||
|
||||
if (cover_fetching_tasks_.isEmpty()) {
|
||||
QTimer::singleShot(2000, statusBar(), SLOT(clearMessage()));
|
||||
progress_bar_->hide();
|
||||
|
||||
jobs_ = 0;
|
||||
got_covers_ = 0;
|
||||
missing_covers_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool AlbumCoverManager::event(QEvent* e) {
|
||||
|
@ -399,7 +452,12 @@ void AlbumCoverManager::FetchSingleCover() {
|
|||
quint64 id = cover_fetcher_->FetchAlbumCover(
|
||||
item->data(Role_ArtistName).toString(), item->data(Role_AlbumName).toString());
|
||||
cover_fetching_tasks_[id] = item;
|
||||
jobs_ ++;
|
||||
}
|
||||
|
||||
progress_bar_->setMaximum(jobs_);
|
||||
progress_bar_->show();
|
||||
UpdateStatusText();
|
||||
}
|
||||
|
||||
void AlbumCoverManager::ChooseManualCover() {
|
||||
|
|
|
@ -32,6 +32,7 @@ class Ui_CoverManager;
|
|||
|
||||
class QListWidgetItem;
|
||||
class QMenu;
|
||||
class QProgressBar;
|
||||
|
||||
class AlbumCoverManager : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
@ -90,6 +91,7 @@ class AlbumCoverManager : public QMainWindow {
|
|||
|
||||
void CancelRequests();
|
||||
|
||||
void UpdateStatusText();
|
||||
bool ShouldHide(const QListWidgetItem& item, const QString& filter, HideCovers hide) const;
|
||||
|
||||
private:
|
||||
|
@ -116,6 +118,11 @@ class AlbumCoverManager : public QMainWindow {
|
|||
QMenu* context_menu_;
|
||||
QList<QListWidgetItem*> context_menu_items_;
|
||||
|
||||
QProgressBar* progress_bar_;
|
||||
int jobs_;
|
||||
int got_covers_;
|
||||
int missing_covers_;
|
||||
|
||||
FRIEND_TEST(AlbumCoverManagerTest, HidesItemsWithCover);
|
||||
FRIEND_TEST(AlbumCoverManagerTest, HidesItemsWithoutCover);
|
||||
FRIEND_TEST(AlbumCoverManagerTest, HidesItemsWithFilter);
|
||||
|
|
Loading…
Reference in New Issue